225 Posted Topics
Re: [QUOTE]format This parameter can be used instead of the fmt24hr and displaySeconds parameters, respectively; it provides a shorthand way to specify the time format you want. Accepted values are 'HHMMSS', 'HHMM', '24HHMMSS', and '24HHMM'. If the format is specified, the other two arguments will be ignored. fmt24hr If True, control … | |
Re: Well you need [URL="http://pypi.python.org/pypi/pyserial/2.5"]Pyserial[/URL] or [URL="http://pypi.python.org/pypi/USPP%20%28Universal%20Serial%20Port%20Python%29%20Library/1.0"]USPP[/URL] if you connect through the COM port. And from there on, more info is needed. Happy coding | |
Re: It does the work, but it's not regex. [CODE]words = ['cataaaaac', 'poolooo'] for word in words: rep = '' count = 0 i = 0 most = '' great = 0 index = 0 start = 0 for char in word: if char == rep: count += 1 if count … | |
Re: OFF-TOPIC [CODE]nod = lambda(x): len(str(x)) print nod(125125)[/CODE] Cheers and Happy coding | |
Re: Like: [CODE]os.system('program.exe | argument')[/CODE] Cheers and Happy coding. | |
Re: As NOT wizards, we don't guess code solutions. Cheers and Happy coding | |
Re: Like this mate. [CODE]import time import subprocess ip = '127.0.0.1' def ping(ip): pinging = subprocess.Popen('ping -w 200 -n 1 ' + ip, stdout=subprocess.PIPE) if "0% loss" in pinging.stdout.read(): return True while 1: if ping(ip): subprocess.Popen('cmd') time.sleep(0.3) else: time.sleep(0.3)[/CODE] Be aware, if you run it like this it will open a … | |
Re: How about all the clients read from the 'channel' they are associated, and post to the 'channel' socket. The server has only receive message, and associate to the proper channel. Cheers and Happy coding. | |
Re: Work it, and post when you get stuck. [CODE]from random import choice first_list = [] second_list = [] for item in open('sampleconnection.txt').readlines(): first, second = item.split('\t') first_list.append(first) second_list.append(second.strip('\n')) for i in range(len(first_list)): choices_list = range(len(first_list) - 1) choices_list.remove(i) print first_list[i], second_list[choice(choices_list)][/CODE] Cheers and Happy coding | |
Re: Litle help... [CODE]for item in pl[section]: if item.has_key('dashboard-tile'): try: print '\t'.join((item['tile-data']['file-label'], item['tile-data']['file-data']['_CFURLString'], item['tile-data']['dashboard-tile'], section, plist_path))[/CODE] Cheers and Happy coding | |
Re: [URL="http://docs.python.org/library/time.html"]Hint[/URL] Cheers and Happy coding | |
Re: Like this? [CODE]for item in fenceLines: print item or for i in range(len(fenceLines)): print fenceLines[i][/CODE] Cheers and Happy coding | |
Re: Line 1 of your convert.py says 'on win32'? I guess that's not valid python code, and thats why the import is failing. Cheers and Happy coding | |
Re: Your code is very messy, very distorted, but if you copy your line 18 to line 25 it will work. Anyway I recommend some clean up. Cheers and Happy coding | |
Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, … | |
Re: [URL="http://www.daniweb.com/forums/thread302912.html"]Similar task[/URL] Try something and we'll help you. Cheers and Happy coding | |
Re: It's pretty to say, but... What types will be the sound files, what you define by instruments(midi, real) and a lot more... Cheers and Happy coding | |
Re: Because dictionaries have hashable values as keys. And so the keys are ordered by their hash. Cheers and Happy coding | |
Re: I don't get it???? Whats the question? You create a picture image object RGB 600 by 600, but you write no data to it. And you do something with a ImageDraw object but I can't see what also. Cheers and Happy coding | |
Re: [CODE]list1 = [] for y in range(50): for x in range(50): list1.append((x, y)) print list1[/CODE] Cheers and Happy coding | |
Re: [QUOTE]An if ... elif ... elif ... sequence is a substitute for the switch or case statements found in other languages.[/QUOTE] [URL="http://docs.python.org/tutorial/controlflow.html"]Source[/URL] Cheers and Happy coding | |
Re: You can catch event with pygame. [URL="http://www.pygame.org/wiki/tut_design"]Here[/URL] Cheers and Happy coding | |
Re: [URL="http://www.wxpython.org/docs/api/wx.calendar-module.html"]Hint[/URL] Cheers and Happy coding | |
Re: ??? A guess... :) [CODE]class foobar(): def __init__(self, foo, bar): # constructor self.foo = foo self.bar = bar[/CODE] Cheers and Happy coding | |
Re: I would do like this for your example, it shows the 'mean' when you just press enter with no input. [CODE]def getlist(): lst = [] x = None while x != '': x = raw_input('Your number:') if x: lst.append(int(x)) return lst def mean(l): return float(sum(l))/len(l) a = mean(getlist()) print a[/CODE] … | |
Re: It depends a lot of the application, and all of that. But maybe a simple http server or json server in a peer to peer configuration should serve the task pretty good. I''ve never tried xmlrpc servers, since I never felt the need to. Cheers and Happy coding | |
Re: [CODE]relevant_weeks = [['[11', " '05/10/2009'", " '06/10/2009'", " '07/10/2009'", " '08/10/2009'", " '09/10/2009']", ''], ['[10', " '28/09/2009'", " '29/09/2009'", " '30/09/2009'", " '01/10/2009'", " '02/10/2009']", ''], ['[27', " '25/01/2010'", " '26/01/2010'", " '27/01/2010'", " '28/01/2010'", " '29/01/2010']", '']] relevant_days = ['TUES', 'TUES', 'THURS', 'WED', 'THURS', 'MON', 'WED', 'THURS', 'WED', 'TUES', … | |
Re: Seems fun but I don't understand. Can you explain? Cheers and Happy coding | |
Re: [URL="http://docs.python.org/library/ssl.html"]SSL wrapper for socket objects[/URL] Cheers and Happy coding | |
Re: Maybe [URL="http://www.dreamfabric.com/sms/"]this[/URL] will help you. Cheers and Happy coding | |
Re: [CODE]f_in = open('mixorder.csv') fields = [] for line in f_in.readlines(): fields.append([item.strip('\n') for item in line.split(',')]) f_in.close() f_out = open('order.csv', 'w') for i in range(len(fields)): if fields[i][0] != '': f_out.write('ORDRE ' + fields[i][0] + ',,\n') elif fields[i][1] != '': f_out.write('Family ' + fields[i][1] + ',,\n') elif fields[i][2] != '': pre = … | |
Re: Like this mate: [CODE]list1 = ['a', 'b', 'c'] for i in range(len(list1)): open('file%s.txt' % i, 'w').write(list1[i])[/CODE] Cheers and Happy coding | |
Re: Hint: [CODE]list1 = [4, 3, 1, 3, 2, 1] list2 = [[0, '0800', 'MON'], [1, '0830', 'MON'], [2, '0900', 'MON'], [3, '0930', 'MON'], [4, '1000', 'MON']] for i in range(len(list1)): for item in list2: if item[0] == list1[i]: print item[/CODE] Cheers and Happy coding | |
![]() | Re: You should check [URL="http://www.crummy.com/software/BeautifulSoup/"]Beatiful Soup[/URL], and [URL="http://docs.python.org/library/urllib.html"]urllib[/URL]. Cheers and Happy coding |
Re: The error message you receive helps who is trying to help you. Try to post it next time. But, since your error is easy, here it goes: [CODE]def lvl(): x = random.randint(100,1000) tfile = open("text.txt", 'w') tfile.write(str(x)) input("")[/CODE] Cheers and Happy coding. | |
Re: Sorry but with such a question I can only think of [URL="www.google.com"]www.google.com[/URL]. Cheers and Happy coding. | |
Re: ??? Something is wrong here. Can you show code to what you do? You can't receive or send data through a socket if you properly closed it. Cheers and Happy coding | |
Re: See the snippet that vegaseat told. Cheers and Happy coding | |
Re: One hint. [CODE]import time date = 19980224 print time.strptime(date, '%Y%m%d') date = 19982402 print time.strptime(date, '%Y%m%d')[/CODE] Cheers and Happy coding | |
Re: Some code to see what you have done so far so we can guide you? Cheers and Happy coding. | |
Re: Like this? [CODE]f_in = open('ids.txt') for line in f_in.readlines(): print line pos = 0 for run in range(line.count('ID=')): pos = line.index('ID=', pos) + 3 print line[pos:pos + 4][/CODE] Cheers and Happy coding | |
Re: The connection is available till you do a db.close() I believe, but I never used MySQL. | |
Re: I,ve found [URL="http://www.cs.cmu.edu/~tmalisie/sword_allocation/ctm.pdf"]this[/URL] for you. Cheers and Happy coding. | |
Re: Why not? [CODE]top10 = [ [[u'abcde', u'fghij'], [1]], [[u'abcde', u'fghij'], [2]], [[u'abcde', u'fghij'], [3]], [[u'abcde', u'fghij'], [4]], [[u'abcde', u'fghij'], [5]]] top10 = [[[str(a), str(b)], x] for [a, b], x in top10] for item in top10: print item[/CODE] [CODE]Output: [['abcde', 'fghij'], [1]] [['abcde', 'fghij'], [2]] [['abcde', 'fghij'], [3]] [['abcde', 'fghij'], [4]] … | |
Re: I would like to help, but I'm not understanding now mate. Cheers and Happy coding | |
Re: Has nothing to do with putting 'self.' on front of everything, but at least being coinsistent on the variables. Look here: [CODE]def onAction(self, event): disc_value = self.discountinput.GetValue().strip() if all(x in "0123456789.+-" for x in disc_value): value = round(float(disc_value), 2) else: discountinput.ChangeValue("number only") [/CODE] Is it discountinput, or the discountinput from … | |
Re: I guess your setup.py is messed up. But as I can't see it, it's only a guess. | |
Re: I think you may use the diff data with the use 'load' to alter the pixels like a array of pixels. Nice project. Cheers and Happy coding | |
Re: Like this mate? [CODE]def DelUserDlg(self, event): dlg = wx.MessageDialog(None, 'Are you sure you want to delete your user?', 'Question', wx.OK | wx.CANCEL | wx.NO_DEFAULT | wx.ICON_QUESTION) result = dlg.ShowModal() dlg.destroy() if result == wx.ID_OK: self.delete_user_function()[/CODE] Cheers and Happy coding | |
Re: Insert the full path to the script instead of just the 'ask.py'. Cheers and Happy coding |
The End.