Re: [Tutor] Question about code reviews

2007-07-15 Thread Kent Johnson
Tino Dai wrote: > Actually, I'm looking for two things: > > I can do stuff with python, but a) is there a better way to do it? b) > What in python don't I know that I don't know. Does that make sense? Reading other people's code is another good way to learn both of these. I found reading the pr

Re: [Tutor] Module imports

2007-07-15 Thread Kent Johnson
kevin parks wrote: > It was explained to me that it is fine to import random, sys and time > in both, and that only the first import uses up memory, and > subsequent attempts to import the same module don't really cost > anything and just add a reference in the namespace. but isn't loading

Re: [Tutor] loop example from 'Learning to Program'

2007-07-15 Thread Luke Paireepinart
ron wrote: > ok, this code is written with vi: > > #/usr/bin/env python > This should be #! not just #, that makes it a regular comment. > #foreach.py > > myList = [1,2,3,4] > for index in range(len(myList)): > myList[index] += 1 > print myList > ~ > > here's the result: > > ~$ ./foreach

Re: [Tutor] loop example from 'Learning to Program'

2007-07-15 Thread Luke Paireepinart
ron wrote: > So I'm starting to work my way through Alan's online > book, reading, then typing in code and seeing it work. > The following is a snippet of code in the Loops > section. I'm getting an error message. > > Here's the code and error message: > > myList = [1,2,3,4] > for index in range(

Re: [Tutor] loop example from 'Learning to Program'

2007-07-15 Thread Luke Paireepinart
ron wrote: > Here's the code and error message: > Where? Is it *gasp* invisdible? > > > > > > Be a PS3 game guru. > Get your game face on with the latest PS3 news and previews at Yahoo! Games. > http://videoga

Re: [Tutor] loop example from 'Learning to Program'

2007-07-15 Thread ron
thanks Luke, you folks are awesome! Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz __

Re: [Tutor] loop example from 'Learning to Program'

2007-07-15 Thread ron
ok, this code is written with vi: #/usr/bin/env python #foreach.py myList = [1,2,3,4] for index in range(len(myList)): myList[index] += 1 print myList ~ here's the result: ~$ ./foreach.py ./foreach.py: line 3: myList: command not found ./foreach.py: line 4: syntax error near unexpecte

[Tutor] loop example from 'Learning to Program'

2007-07-15 Thread ron
So I'm starting to work my way through Alan's online book, reading, then typing in code and seeing it work. The following is a snippet of code in the Loops section. I'm getting an error message. Here's the code and error message: myList = [1,2,3,4] for index in range(len(myList)): myList[in

Re: [Tutor] Newbie Project part 2...

2007-07-15 Thread Bob Gailer
Here's a list-based alternative: tree = [ ["You have just turned 18 years old. Your life awaits,... choices to be made..", ["Army", ["win Silver star", ["reenlist", [] # next lower level... ], ["retire", [] ]

[Tutor] loop example from 'Learning to Program'

2007-07-15 Thread ron
Here's the code and error message: Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 ___

Re: [Tutor] Bundle help!

2007-07-15 Thread bhaaluu
Hi! http://docs.python.org/lib/module-re.html Regular Expressions module. On 7/15/07, Sara Johnson <[EMAIL PROTECTED]> wrote: > > > Just curious, but in this link (' > http://xahlee.org/perl-python/sort_list.html ') you > mentioned, what does the "re" part mean? At firs

Re: [Tutor] Bundle help!

2007-07-15 Thread Sara Johnson
Regarding my early question on bundle. Not sure if this makes any sense, but I noticed where else it's used. If this looks funny, remember that I did not write it (and therefore do not entirely understand it). I'm only editing it according to some specific guidelines. >>>for key in h.ke

Re: [Tutor] Newbie Project part 2...

2007-07-15 Thread Tony Noyeaux
Thanks for your reply Alan. Reorganizing the data into a dictionary format, not sure i understood your structure below, but understood the need to reorg my data into dictionaries. Was wondering it would work if i created two dictionaries; One say,... results, the other questions. Reorganizi

Re: [Tutor] Bundle help!

2007-07-15 Thread Sara Johnson
Thanks to everyone for your help and quick responses! Has anyone heard of the "bundle method?" Some of you have already said you didn't. I wonder why it's included as part of my code/instructions. I'm trying to accomplish what I 'think' they want with the other questions I've posed here

[Tutor] Searching Algorithm

2007-07-15 Thread Pradeep Kumar
Hi All, I have a bulk of data in .txt, SQL Server 2000, .xls file(s) either in structured or without I want to search specific data in it. How I can. Any fastest algorithm for searching data (like google style) Pradeep ___ Tutor maillist - Tutor@pyt

Re: [Tutor] reading random line from a file

2007-07-15 Thread Luke Paireepinart
max baseman wrote: > cool thanks > > oh for performance eventualy i would like the file to contain many quotes Using readlines isn't exactly going to cause a performance bottleneck. I used the following code #make the file.py f = file("temp.txt","w") x = 10 while x > 0: f.write("aaa