Re: [Tutor] declaring list in python

2006-01-10 Thread Brian van den Broek
Logesh Pillay said unto the world upon 10/01/06 11:28 PM: > Hello list > > I want to declare a list of a specific size as global to some nested > function like so Hi Logesh, what problem are you trying to solve by doing this? Knowing that will help generate more useful answers, I suspect.

[Tutor] declaring list in python

2006-01-10 Thread Logesh Pillay
Hello list I want to declare a list of a specific size as global to some nested function like so def foo (n): A[] (of size n) def foo1 ... The only way I can think to declare the list is to use dummy values: A = [0] * n A = [] * n doesn't work. [] * n =

Re: [Tutor] How can I make a python script go directory by directory and excecute on files of choice

2006-01-10 Thread Liam Clarke
Hi Srinivas - For walking a directory, you can use os.walk() or os.path.walk(), but I prefer the path module here - http://www.jorendorff.com/articles/python/path/. As for determining if a file is really an .XLS format file or a tab delimited file with .xls on the end, go to www.wotsit.org, have

Re: [Tutor] need help with syntax

2006-01-10 Thread John Fouhy
On 11/01/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote: > time = struct.unpack(">steps+f",c) > adding the f to tell structs it is in float format > > the string substitution > seems like it would work but now I cant figure out how I would add the > f on the end Did you read up on string substitu

[Tutor] Fwd: need help with syntax

2006-01-10 Thread Liam Clarke
oops, forward to list. -- Forwarded message -- From: Liam Clarke <[EMAIL PROTECTED]> Date: Jan 11, 2006 4:18 PM Subject: Re: [Tutor] need help with syntax To: bill nieuwendorp <[EMAIL PROTECTED]> On 1/11/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote: > hello all I am new to pyth

Re: [Tutor] need help with syntax

2006-01-10 Thread bill nieuwendorp
Hi John thanks for the tips I had a bit of a typo in my first post time = struct.unpack(">steps",c) should read somthing more like time = struct.unpack(">steps+f",c) adding the f to tell structs it is in float format the string substitution seems like it would work but now I cant figure out h

Re: [Tutor] need help with syntax

2006-01-10 Thread John Fouhy
On 11/01/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote: Hi Bill, Some comments --- > >>> import struct > >>> import string > >>> f = file('binary_file','rb') > >>> line = f.readline() > >>> L = tuple(line) You can do slicing (things like L[:4]) on strings as well as on lists and tuples. So th

[Tutor] need help with syntax

2006-01-10 Thread bill nieuwendorp
hello all I am new to python and this list has been helpfull so far I am trying to convert binary file to ascii here is the format spec steps = int 4 value = int 4 time = float 4 * steps so in the python terminal terminal i convert it like this >>> import struct >>> import string >>> f = file

[Tutor] How can I make a python script go directory by directory and excecute on files of choice

2006-01-10 Thread Srinivas Iyyer
Dear group, I have Excel files that are arranged according to transctions under various name/directories. I found out that all these Excel files are not real OLE based files and some of them are really tab delim files with .XLS appended to the end of file name. I got fooled and started using pyEx

Re: [Tutor] Python RE uses DFA or NFA for string check?

2006-01-10 Thread Intercodes
Thanks Mr.Tim. That was helpful :)On 1/10/06, Tim Peters <[EMAIL PROTECTED]> wrote: [Intercodes]> This question is just out of curiosity. I am working with this dragon book.> From what I have learnt so far, RE uses either NFA or DFA to check whether> the string is accepted or not. (Correct?) In the

Re: [Tutor] Python RE uses DFA or NFA for string check?

2006-01-10 Thread Tim Peters
[Intercodes] > This question is just out of curiosity. I am working with this dragon book. > From what I have learnt so far, RE uses either NFA or DFA to check whether > the string is accepted or not. (Correct?) In the world of "computer science" regular expressions, yes. But the things _called_

Re: [Tutor] Python RE uses DFA or NFA for string check?

2006-01-10 Thread Kent Johnson
Intercodes wrote: > Hello everyone, > > This question is just out of curiosity. I am working with this dragon > book. From what I have learnt so far, RE uses either NFA or DFA to check > whether the string is accepted or not. (Correct?) > > So what does the Python's RE module use to check the c

[Tutor] Python RE uses DFA or NFA for string check?

2006-01-10 Thread Intercodes
Hello everyone,This question is just out of curiosity. I am working with this dragon book. From what I have learnt so far, RE uses either NFA or DFA to check whether the string is accepted or not. (Correct?) So what does the Python's RE module use to check the correctness of the string, NFA or DFA?