225 Posted Topics
Re: This simple solution will work for all files on the current dir. [CODE]import os filelist = os.listdir('') for files in filelist: basename, ext = os.path.splitext(files) if ext == '.kml': f_output = open('%s-errors.txt' % basename, 'w') f_output.write('whatever you want') f_output.close()[/CODE] Cheers and Happy coding | |
Re: Post some code, it should be easy to try to correct. Cheers and Happy coding | |
Re: A example: [CODE]print item.lower()[/CODE] Cheers and Happy coding | |
Re: I think that definatelly it's a bad version installed. Try to redownload and install the proper ones. Cheers and Happy coding | |
Re: Doesn't this work? [CODE]from login import LoginDlg[/CODE] | |
Re: By your error message it appears that your values are being correctly extracted from the controls,. The problem relys elsewhere I believe. | |
Re: Mate, I believe that all you need to do, it's to use my example of timer, and use it to call the function to voice, instead of the threading being the voice function, the thread will calll the object voice after that time. Hope is clear enough. Cheers and Happy … | |
Re: If i understood correctly: [CODE]initial_date = '9/14/1990' initial_month, initial_day, initial_year = initial_date.split('/') final_date = '9/17/1990' final_month, final_day, final_year = final_date.split('/') f_in = open('stations_temp.csv').readlines() f_out = open('filtered_stations_temp.csv', 'w') f_out.write(f_in[0]) for i in range(1, len(f_in)): station, date, max_temp, min_temp = f_in[i].split(',') month, day, year = date.split('/') if initial_month <= month <= final_month … | |
Re: Some code and a clear explanation of the problem you have would help. Cheers and Happy coding | |
Re: Probably beacuse uou only have 239 lines, and are cycling the variable that use as index to a higher number then the elements of the list. You should count the elements and cycle between that counting. Cheers and Happy coding | |
Re: Something like this: [CODE]app = wx.App(redirect=True)[/CODE] and wx does the rest. Cheers and Happy coding. | |
Re: The 'blit' loads a image object to the window surface. In your example 'blit' loads the 'background' image to the window starting at cordinates 0 in x and 0 in y. [CODE]screen.blit(background, (0, 0))[/CODE] The second 'blit' loads the 'sprite' image to the screen, with a fixed cordinate of 100 … | |
Re: I don't get the previous link. May you take a look here, fell free to ask, or PM with sugestions. [URL="http://www.daniweb.com/code/snippet304075.html"]Texts K-Nearest Neighbor (KNN) using the Euclidean algorithm[/URL] | |
Re: A tip: [CODE]for line in in_file.readlines():[/CODE] Cheers and Happy coding | |
Re: Seem's easy. Can you post the file? The text pasted on the thread normally does'n keep all the text characteristics. Cheers and Happy coding. | |
Re: You just need to now how much lotion you need sy square centimeter and apply to that surface. But first, what is suposed that number to do? [CODE]def main(): '''program to determine a persons surface area''' height = float (raw_input ("How tall are you (cms?) ? ")) weight = float … | |
Re: Like this maybe. The list and sorting it makes it easy. [CODE]def main(): diverName = raw_input('Enter divers name: ') degreeOfDifficulty = input('Enter degree of difficulty: ') scoreList = [] for scoreCounter in range(1, 8): scoreList.append(input('Enter score %s: ' % scoreCounter)) sortedScores = sorted(scoreList) print '\nhighscore = %s\nlowscore = %s' % … | |
Re: It's a typo. Your missing a d here. [CODE]elif option == 2: remove[COLOR="Red"][B]d[/B][/COLOR]Expence = removeExpence(totalBudget) totalBudget = totalBudget + removedExpence printOptions() option = input("What would you like to do? ")[/CODE] | |
Re: [URL="https://www.packtpub.com/expert-python-programming/book"]Expert Python Programming[/URL] [URL="http://www.qtrac.eu/pyqtbook.html"]Rapid GUI Programming with Python and Qt[/URL] My choices would go on this ones. I would choose others if iw was game related or advanced debugging. Cheers and Happy coding | |
| |
Re: Sorry but all I can say is: You must be kidding! Not a litle effort, just a line question? Cheers and Happy coding | |
Re: [URL="http://www.secdev.org/projects/scapy/doc/installation.html#windows"]You must begin here.[/URL] | |
Re: I never went, but with some sample xml and some code effort, you may get someone attracted to the conversation. Cheers and Happy coding. | |
Aproach to the implementation of K-Nearest Neighbor (KNN) using the Euclidean algorithm. Sample Usage: [CODE]mywork = Words_Works() lit = 'literature.txt' mywork.add_category(lit, 'Literature') # adding files as category comp = 'computers.txt' mywork.add_category(comp, 'Computers') phy = 'physics.txt' mywork.add_category(phy, 'Physics') # saving categories dictionary to file mywork.save_categories() # can be loaded calling load_categories() … | |
Re: Something like this. [CODE]name = [] ordertotal = [] for i in range(loopController): name.append(raw_input("Who's order")) order = input("How much was the order") ordertotal.append(order + shippingCharge) for i in range(loopController): print name[i], ordertotal[i][/CODE] | |
Re: I don't know if it is this function but this should work. [CODE]from scipy.special import kv[/CODE] Happy coding | |
Re: Create function to voice users and run the function using the timer, instead of passing commands to the timer function. | |
Re: Can you provide a sample file. Your sample doesn't even have the GE. I changed the second BS tag to GE. [CODE]f_in = open('blocks.txt').read() f_out = open('output.csv', 'w') f_out.write('AC\tID\tFA\tOS\tSF\tBS\tGE\n') blocks = [x for x in f_in.split('//') if x] for item in blocks: infos = [x for x in item.split('\n') if … | |
Re: Some search [URL="http://www.blog.pythonlibrary.org/2010/07/16/python-and-microsoft-office-using-pywin32/"]and...[/URL] Post if you get stuck later. :) Cheers and Happy coding | |
Re: Maybe like this? [CODE]import string def RemovePunc(text_input): line = [] i = 0 total_text_input = "" #This part removes the punctuation and converts input text to lowercase new_char_string = "" for char in text_input: if char in string.punctuation: char = " " new_char_string = new_char_string + char line = line … | |
Re: I use cx_freeze on win32 without minimum problem. Have you tried this? [URL="http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html"]py2app - Create standalone Mac OS X applications with Python[/URL] Happy coding | |
Re: I don't get it. Something weird. :D Can you post the db. | |
Re: lol How about some search? I've written something easilly adjustable for some user something like one week ago. [URL="http://www.daniweb.com/forums/thread300520.html"]Finding string instance in file - replace bytes after it[/URL] | |
Re: With a simple hex editor you can see that the GIMP file headers are completely different. Cheers and happy coding | |
Re: [CODE]import os os.system(r'C:\dtexec /f "PACKAGENAME.dtsx"')[/CODE] Cheers and Happy codding | |
Re: [QUOTE]If the submitted form data contains more than one field with the same name, the object retrieved by form[key] is not a FieldStorage or MiniFieldStorage instance but a list of such instances. Similarly, in this situation, form.getvalue(key) would return a list of strings. If you expect this possibility (when your … | |
Re: I don't really understand the context but... [CODE]def high_Priority(): ## print'' import shelve file_sizeh = file_size * week_selec db = shelve.open("netback.dat") db['hremspace'] = h_back if h_back > 0: print'There are ',db['hremspace'],' Mb's left in High priority storage' print'after your backup of ',file_sizeh,' Mb's' db['hremspace'] = h_back db['netback'] = back_name db['Highprofile'] … | |
Re: The breaks are your problem. Try to take them out. Happy coding... | |
Re: Like this? [CODE]def periodic(): global t print "Tic-Tac" t = threading.Timer(2, periodic) t.start() t = threading.Timer(2, periodic) t.start()[/CODE] Happy coding | |
Re: Like this? [CODE]totalRows = int(raw_input ("Please enter a number: ")) for currentRow in range(1, totalRows + 1): print '* ' * currentRow print for currentRow in reversed(range(1, totalRows + 1)): print '* ' * currentRow[/CODE] | |
ITunes Library Persistent ID Editor. Sample usage: [CODE]fxml = 'iTunes Music Library.xml' # path to xml file fitl = 'iTunes Library.itl' # path to itl file itk = ITunesLibKeys(fxml, fitl) print itk.file_xml # prints path to xml file print itk.file_itl # prints path to itl file print itk.xml_key # prints … | |
Re: How do you get those times? | |
Re: [CODE]import os import signal processname = 'sysproc' for line in os.popen('ps xa'): if processname in line.split()[4]: os.kill(int(line.split()[0]), signal.SIGHUP)[/CODE] | |
Re: It's like this you must do it on your terminal window like this: [CODE]python /Users/Home/Desktop/Programs/test2.py[/CODE] or just by the scipt name if you add the shebang: [CODE]#!/usr/bin/python[/CODE] to the first line of your script. Happy coding! Cheers | |
Re: And the code? I can't see it. lol :) [CODE]f_score = open ('score.txt') old_score = int(f_score.readlines()[0]) f_score.close() score = 80 print old_score if score > old_score: f_score = open ('score.txt', 'w') f_score.write('%s' % score) f_score.close()[/CODE] | |
Re: You must return the value from the recursive function. [CODE]def function(depth): if depth > 0: return function(depth - 1) else: return 10 function(5)[/CODE] EDIT: Sorry, was testing it while it was answered. | |
Re: I'm sorry but I'm going to redirect you. lol [URL="http://www.xml.com/pub/a/2003/02/12/py-xml.html"]I believe this is the right point to redirect you.[/URL] | |
Re: How about you post some file and some code, so we can toy with also. ;) Happy coding! | |
Re: Gribouillis said it all. There is no reason for repeating code when it can be reused. | |
Re: Here it is. [CODE]import warnings def maxgen(fname, worksheet=1,encoding='cp1251'): warnings.filterwarnings('ignore') from pyExcelerator import * warnings.filterwarnings('always')[/CODE] Happy coding... |
The End.