904 Posted Topics
Re: Writing your print statement to file: [code=python]# open/create text file for writing in main() fout = open( "test1.txt", "w" ) # may need "a" for append # in your program under this line # print '\tn: %d, sort time: %f' % (n, dt) # add this line print >>fout, '\tn: … | |
Re: I agree, whoever gets to 20,000 posts first should get the immensely coveted "Fickle Finger of Fate" award. | |
Re: You can also use Python's module profile: [code=python]import profile def get_primes3(n): if n < 2: return [] if n == 2: return [2] nums = range(3, n, 2) idx = 0 while idx <= (n - 1)**0.5 - 2: for j in xrange( idx + nums[idx], n//2 - 1, nums[idx] … | |
Re: [QUOTE=joshSCH;529078]Wow.. I think that post proves that you are a young, naive fool.[/QUOTE]Mon dieu, if Lardmeister is one fool than what are you? How low can you go? | |
Re: [QUOTE=Lardmeister;593759]When I grow up I would love to look like Rodney Dangerfield. He made tons of money with his astonishingly good looks.[/QUOTE]Rodney is one wonderful man, but when I grow up I rather want to look like actor Jean-Claude Van Damme. He has muscles like Arnold Schwarze... , but he … | |
Re: Is file you want delete still on your editor? | |
Re: One way to do this is to have your running application update shared datafile that can than be read from your Python program. | |
Re: There are number of ways, but this way I mostly use: [code]# sorting a list of lists by index def sort_inner(inner): """ inner is each inner list in the list of lists to be sorted (here item at index 1 of each inner list is to be sorted) """ return … | |
Re: Ubuntu seems to be one ugly beast, I have heard other poeple complain about it, particularly Python programmers. | |
Re: Sky diving, ski jumping, car racing, target shooting, sailing, romance. | |
Re: Don't you just love those arcade games, could play them for many hours. | |
Re: That handy round roll of paper is indispensable! I have not seen any software to replace it properly. | |
Re: It would be very nice if you would use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help. [noparse][code=python][/noparse] your Python code here [noparse][/code][/noparse] | |
Re: Variable myFile is just file handle, what do you expect join() would do to it? | |
Re: It's not-in-jail older folks with bad morals that teach younger folks bad habits. | |
Re: [QUOTE=GrimJack;594581]jwenting - you spew the most amazing, er 'stuff'. George W. Bush was a draft dodger who got into the Guard thru political influence. While in the guard, he essentially went AWOL and was not seen by his commander for over a year. To be honest, I don't 'hate' much … | |
Re: My God, that Python version must be at least 10 years old. I don't think pyTTS was out then. | |
Re: When you see code like this, sometimes it's enlightning to print out the variable for test. Yes, you can multiply lists. | |
Re: The simplest functions to search a string are find() and index(). | |
Re: Learn the Python language, then you can talk it into going on a diet. Your python is in it's main growing stage, just keep feeding it, it will grow out of that hungry habit. | |
Re: The corresponding Python structure would be dictionary with one key and list or tuple with two values. | |
Re: Have you looked at Cython? Good way to interface C and Python. | |
Re: I saw one movie about slaughter houses when I was in elementary school. About half the kids would not eat meat afterwards. | |
Re: Hits you right in the tear duct! I wonder what land locked countries have to present. | |
Re: Your program reads in all the lines into one list of lines and then even makes one copy of this rather large list. The code below reads in the lines as needed for processing: [code=python] ... for vhstring in file(vhdat): # remove trailing whitespace vhstring = vhstring.rstrip() # your processing … | |
Re: Here is older dragdrop example for Tkinter: [url]http://www.faqts.com/knowledge_base/view.phtml/aid/4383[/url] | |
Re: You are trying to concatinate class instance with string ".ac" that will not work. Why don't you simply create the new class attribute dynamically this way and then you can use it. [code]searchSpace[0].ac = None [/code] | |
Re: When you run the above file, carefully read the messages. PIL has history of giving problems with py2exe. Just for testing, use small PIL program with py2exe. Of course, I am using Windows Vista and expect all sorts of problems anyway! | |
| |
Re: The best way to pick random integers between 1 and 15 is this way: [code=python]import random # selects one random integer from 1 to 15 pick = random.randint(1, 15) [/code]Then you set up one 'endless while loop' asking the user to enter the guess. Use series of if/elif statements comparing … | |
Re: Thank you jwenting for identifying the axis of evil right here. May God and his son Jesus bless you! | |
Re: Just waiting till Google comes out with their neat no nonsense (NNN) OS. | |
Re: [QUOTE=Google Spider;583107]I will make a second account and try it out, let's see how it goes:icon_cheesygrin:[/QUOTE]You find it easier to simply follow the rules, easier for you, the members (posting buddies), and DaniWeb mods. | |
Re: I think Jwentings plane #10 might be F5 Tiger (Freedom Fighter), possibly one of the ones that the Shah of Iran purchased. | |
Re: In Python use: [code=python]s = """return false; } function validPeriod() { for (var i = 0; i < periods.length; i++) { """ # test it print s [/code] | |
Re: Just starting Python? [url]http://learnpython.pbwiki.com/HowToStart[/url] | |
Re: Compared to Java, Python has simplified a lot of the syntax. It will spoil you, and you may actually have fun. | |
Re: Citroën C3 would do very nicely! Very good milage, sharp look and reliable. Actually, I would love to drive this 1924 Citroën CV, real party car! | |
Re: You need to study up on argument passing to and from functions. I put some comments into your code to help you: [code=python]def ask_hours(): hours = float(raw_input ("How many hours did you work? ")) rate = float(input ("What is your rate of pay? ")) # return the two arguments as … | |
Re: Have you looked at: [url]http://www.daniweb.com/code/snippet594.html[/url] | |
Re: Something like that? [code=python]def foo(): return foo.bar foo.bar = "foobar" print foo() # foobar [/code] | |
Re: Looks to me like you have to study the module audio somewhat closer. | |
Re: [QUOTE=DimaYasny;550924]yeah, CNN, BBC, Reuters and everyone else is pro-terrorist, and there isn't much to be done about it. ... [/QUOTE]That is utter nonsense! | |
Re: L'anglais seulement, svp! | |
Re: I have gone to Area 52, and that is even more secret. Just to mention that you were there puts your life in danger. Hey, I love to live dangerously! |
The End.