Re: [Tutor] search through a list

2005-07-03 Thread Brian van den Broek
nephish said unto the world upon 02/07/2005 23:41: > hey there > i have a file that i want to read. > each line in the file is the name of a file. > the next line is how many lines are in that file. > > example of loglist.txt > > log1.txt > 232 > log2.txt > 332 > log3.txt > 223 > > so log1 is a

[Tutor] a question

2005-07-03 Thread Xinyue Ye
when I type sys.ps2 after import sys, I got the message like: Traceback (most recent call last): File "", line 1, in -toplevel- sys.ps2 AttributeError: 'module' object has no attribute 'ps2' why does it happen? ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] Iterating over nested lists part2

2005-07-03 Thread Luis N
On 7/2/05, Kent Johnson <[EMAIL PROTECTED]> wrote: Luis N wrote:> def listItems():> l= []> d = {}> for r in range(len(vw)):> for x in range(lt):> ed = desc[x]> exec("d['%s']=vw[%d].%s" % (ed,r,ed)) > l.append(d)> print lIf I understand correct

Re: [Tutor] search through a list

2005-07-03 Thread Light
> import os > > #get a list of Logs in logs folder > LogFiles = os.listdir('/home/nephish/Projects/Piv_GCI/logs') > > #open the loglist file and read the lines > LogList = open('home/nephish/Projects/Piv/logs/LogList.txt', 'r') > LogsRead = LogList.readlines() > > #see if there is  a new log file.

Re: [Tutor] search through a list

2005-07-03 Thread Sandip Bhattacharya
nephish wrote: > LogList = open('home/nephish/Projects/Piv/logs/LogList.txt', 'r') > LogsRead = LogList.readlines() > > #see if there is a new log file. > for i in LogFiles: > if LogFiles[i] not in LogList: Don't you mean "if LogFiles[i] not in LogsRead" ? - Sandip -- Sandip Bhattacharya

Re: [Tutor] a question

2005-07-03 Thread Kent Johnson
Xinyue Ye wrote: > when I type sys.ps2 after import sys, > I got the message like: > Traceback (most recent call last): > File "", line 1, in -toplevel- > sys.ps2 > AttributeError: 'module' object has no attribute 'ps2' > why does it happen? >From the docs: ps1 ps2 Strings specifying the pr

Re: [Tutor] a question

2005-07-03 Thread Alan G
It works Ok for me, can you cut and paste the full session so we can see exactly what is happening. Also, what environment are you running it in? Windows/Linux/MacOS? IDLE, Pythonwin, Pycrust? All of that might be relevant. Alan G. - Original Message - From: "Xinyue Ye" <[EMAIL PRO

Re: [Tutor] How to get 4 numbers from the user in one line for easycomparision?

2005-07-03 Thread Alan G
> I Just need to figure out how to get 4 numbers from > the player on one line for easy comparison, Unless there is a set of batteries somewhere that I don't know about I think you have to rely on reading the line as a string and then splitting it. line = raw_input('Type 4 numbers separ

[Tutor] search through a list

2005-07-03 Thread nephish
Hey there thanks, quote: /try num_of_lines = line_find(LogsRead, "PV050614.LOG") I am binding num_of_lines to the return value. In an interactive session, without the binding, a non-None return value will display on screen. But both interactively and in a program binding it makes it easier t

Re: [Tutor] wxPython shaped window

2005-07-03 Thread Liam Clarke
To totally not answer your question, check out - pythoncard.sourceforge.net It's the Visual Basic Userform IDE of wxPython. :) On 7/1/05, Adam Bark <[EMAIL PROTECTED]> wrote: On 6/26/05, Adam Cripps < [EMAIL PROTECTED]> wrote: On 6/25/05, Adam Bark <[EMAIL PROTECTED]> wrote:> Thanks for the info

Re: [Tutor] OT self-implementation?

2005-07-03 Thread Danny Yoo
> > (*)One of the hardest malicious bugs I've seen was by a disgruntled > > employee who deliberately inserted a bug into the C source of the > > companies compiler. He then recompiled the compiler (using the working > > compiler) to produce a faulty compiler. He then removed his bugs in > > the so

Re: [Tutor] OT self-implementation?

2005-07-03 Thread Danny Yoo
> > Now's not the time in my life to start a comp. sci. degree. So, my > > questions are: > > > > 1) What would be good terms to google for to find an explanation of > > how the seeming magic doesn't violate all reason? Hi Michael, The idea is that we can use _ourselves_ as the initial compiler

Re: [Tutor] How do I make Python calculate square roots?

2005-07-03 Thread Danny Yoo
On Sat, 2 Jul 2005, Reed L. O'Brien wrote: > > Does anyone know how to make Python calculate square roots? > > > Raise to the 1/2 power. > > >>> 4**.5 > 2.0 > >>> 16**.5 > 4.0 > >>> 81**.5 > 9.0 By the way, if you need to take the square roots of negative numbers, then the 'sqrt' function

Re: [Tutor] OT self-implementation?

2005-07-03 Thread Alan G
> You may find the following paper by Ken Thompson an interesting one on > this topic: "Reflections on Trusting Trust": > > http://www.acm.org/classics/sep95/ > > It follows the exact stuation that Alan mentioned. Yes, I hadn't seen the Thompson paper before but I notice it was dated 1989 and

[Tutor] Sudoku puzzle implementation

2005-07-03 Thread Liam Clarke
Hi all, If you aren't aware of Sudoku, this is it - http://www.sudoku.com/ Big craze at my office, and I've just been wracking my brains to try and think of how to model it in Python (in order to solve.) What I'm not sure of is how to implement it. Basic rundown of a Sudoku puzzle is - Gen

[Tutor] search through a list

2005-07-03 Thread nephish
Hey there, sorry to bother you again about this same problem but i have a line of code in this same issue that works in idle but it does not work in a regular script. that same thing i am trying to do, reading the directory, comparing the list of files to a list . just want to catch the newes

Re: [Tutor] Sudoku puzzle implementation

2005-07-03 Thread Chinook
Liam, I couldn't get "into" your approach at the moment, but I was wondering if you have looked at the following: First, the Reverse Puzzle section of: http://cs.gettysburg.edu/~tneller/resources/ai-search/uninformed-java/ and secondly more generally: http://www.gamedev.net/reference/articles/a

[Tutor] Confused about error message

2005-07-03 Thread gelsey torres
I'm new to Python and computer programming in general. Eventually I got sick of just reading my programming books and typing code from them into the interpreter, so I decided to write a script that will grab files from websites and save them to the hard drive, and if they're compressed, unzip them.

Re: [Tutor] Confused about error message

2005-07-03 Thread Kent Johnson
gelsey torres wrote: > def unzip_file(filename): > print "Unzipping file.." > for file in filename: > try: > file = os.path.split(filename)[2] > file += zlib.decompressobj() > > def main(): > address = raw_input("Enter the address of the site