- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 38
- Posts with Upvotes
- 38
- Upvoting Members
- 20
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: Dont forget to select your code and press (CODE) next time. And do you have a sample file, becasue this normally works. import csv for row in csv.reader(open('mesaure.csv')): print row | |
Re: Can't you do like this: [CODE]d['key']['fieldname'][/CODE] | |
Re: Like this? [CODE]#!/usr/bin/env python import urllib def save_page(site="http://www.tvrage.com/Warehouse_13/episode_list"): mypath = site f = open('temp2.txt', 'w') for item in urllib.urlopen(mypath).readlines(): f.write(item) f.close() def find_title(temp="temp2.txt"): f = open(temp) site = f.readlines() f.close() for item in site: if item.find('<title>') != -1: before_html, tag_before, rest_html = str(item).partition('<title>') title, tag_after, after_html = rest_html.partition('</title>') print 'Title:', … | |
Re: A twin brother??? http://code.activestate.com/recipes/496778-binary-converter10/ | |
Re: ??? Does yours outputs like this mate? [CODE]>>> import unittest >>> dir (unittest) ['FunctionTestCase', 'TestCase', 'TestLoader', 'TestProgram', 'TestResult', 'TestSuite', 'TextTestRunner', '_CmpToKey', '_TextTestResult', '_WritelnDecorator', '__all__', '__author__', '__builtins__', '__doc__', '__email__', '__file__', '__metaclass__', '__name__', '__package__', '__unittest', '__version__', '_makeLoader', '_strclass', 'defaultTestLoader', 'findTestCases', 'getTestCaseNames', 'main', 'makeSuite', 'os', 'sys', 'time', 'traceback', 'types'] >>> print unittest.TestCase <class … | |
Re: Can you provide a sample xml and itl, it's a pretty easy task to achieve. Cheers and Happy coding... | |
Re: So you can't read C++, and want to convert some C++ files to Python? How about leaking the C++ files so we can help you? Meanwhile, i'll google for tools. ;) | |
Well, it bothers me to build menus for every shell application that needs one. So, I've written a module to handle that, like in the good old turbo pascal times. :) Here it is, the module comments are pretty explainatory, I think, and the sample usage if run as script … | |
Simple script for image transparency. Someone asked one some time ago, and i had other but for a different system, and decided to write a Python/PIL version. The value of the color used as transparent is the value of the pixel at position (0, 0). You can adjust tolerance value. … | |
Re: You don't have questions, nowone cared about this, so just let it sink, till someone finds it attractive. Cheers and Happy coding | |
Re: [URL="http://docs.python.org/tutorial/index.html"]One of my favorites, it just explains you everything, has a lot of examples.[/URL] | |
| |
Re: Going from the root as as folder python, [CODE]python\Objects\intobject.c[/CODE] Cheers and Happy coding | |
Re: Have you tried [URL="http://www.pygame.org/docs/ref/joystick.html"]pygame.joystick[/URL]. Wheres the code? Cheers and Happy coding | |
Re: doffing81, theres no need to hardcode the 5 deals. [CODE]def deal(): """this function deals the cards individually to each hand""" for i in range(5): self.append(deck.pop(0)) #pop(0) grabs the first card/item in list p2.append(deck.pop(0)) #pop() would grab last...I believe p3.append(deck.pop(0)) p4.append(deck.pop(0))[/CODE] Cheers and Happy coding | |
Re: You want all the output in text file, or only the error output? Wich OS? Are you using GUI? Cheers and Happy coding | |
Re: You can run the listening function on an asynchronized thread. [CODE]from functools import wraps from threading import Thread def async(func): @wraps(func) def async_func(*args, **kwargs): func_handler = Thread(target=func, args=args, kwargs=kwargs) func_handler.start() return func_handler return async_func @async def listener(): print "Initializing Listener..." Listener.Listen(server_ip, int(server_port)) os.system("cls") print "Server IP: %s" % server_ip + … | |
Re: This should be faster. [CODE]lines = [line for line in tx.readlines(2000000)][/CODE] Cheers and Happy coding | |
Re: What you mean? Like clipboard access? Or a internal function? Copy to variable and write the variable to the widget maybe? Cheers and Happy coding | |
Re: Something like... [CODE]self.transport.getDestination()[/CODE] Cheers and Happy coding | |
| Re: I can't see the problem, and it's working good. Maybe IDLE? Maybe version of the pygame you use? Cheers and Happy coding |
Re: You don't need to display them, if you maintain a list of the image objects open, you can easilly save them all in a nice loop. Show a example of what you mean, I'll help you. Cheers and Happy coding | |
Re: [CODE]class SpeciesGrid(wx.Frame): self.EnglishNameList = ['Great Tit','Marsh Tit','Coal Tot','Crested Tit'][/CODE] Your code defines EnglishNameList as a attribute of the SpeciesGrid class, so you must change the [CODE]self.EnglishNameList[/CODE] on the SearchDlg class by something like [CODE]SpeciesGrid.EnglishNameList[/CODE]. Cheers and Happy coding | |
Re: The usage is [CODE]SetGridCursor(self, row, col)[/CODE], so why collumn -1 on your code mate? [CODE]self.SpeciesGrid.SetGridCursor(ind, -1)[/CODE] Cheers and Happy coding | |
Re: Add '\n' in each write. Cheers and Happy coding | |
Re: Only the print implementation. You can do [CODE]from __future__ import print_function[/CODE] and keep the 3.x print style. Cheers and Happy coding | |
Re: It seems to work here... [CODE]import re print re.findall('[0-9][0-9][0-9]\.', '1234_.txt') print print re.findall('[0-9][0-9][0-9]\.', '1234.txt')[/CODE] Can you explain what's not working. Cheers and Happy coding | |
Re: The distance between vectors, presuming you have vector A and B with two coordinates x and y, is: [CODE]sqrt(((Ax - Bx) ** 2) + ((Ay - By) ** 2))[/CODE] | |
Re: @staticmethod returns a static method for function. @classmethod returns a class method for function. The classmethod is called with the 'cls' argument as first argument and it represents the class. It's called when you create a class object and will serve as constructor for the class. At line 13 it … | |
Re: You have [URL="http://docs.python.org/library/urllib2.html"]urllib2[/URL] also, or you can try with the Beautiful Soup. Cheers and happy coding |