RE: Reading files into a 2D list.

2005-05-11 Thread Oyvind Ostlund
guages and libs like DirectX lately. Thanks ØØ -Original Message- From: Larry Bates [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 11, 2005 3:55 PM To: Oyvind Ostlund Cc: python-list@python.org Subject: Re: Reading files into a 2D list. Few observations. 1) Don't concatenate pa

Re: Reading files into a 2D list.

2005-05-11 Thread Larry Bates
Few observations. 1) Don't concatenate pathnames yourself use os.path.join, that makes your code portable. lexi_file = open(os.path.join(sys.path[0],"lexi",files), "r") 2) Start with an empty list and append your "lines" lists: files_and_lines=[] filenumber = 0 for files in file_names: fpa

RE: Reading files into a 2D list.

2005-05-11 Thread Oyvind Ostlund
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Alexander Seistrup Sent: Wednesday, May 11, 2005 12:14 PM To: python-list@python.org Subject: Re: Reading files into a 2D list. Øyvind Østlund wrote: > I have a list of about 20 files that I w

Re: Reading files into a 2D list.

2005-05-11 Thread Klaus Alexander Seistrup
Øyvind Østlund wrote: > I have a list of about 20 files that I want to read line by > line into a 2D list. So the first dimension will be each file, > and the second every line in that file. > > I tried to do something like this: > > files_and_lines = [][] > filenumber = 0 > > for

Reading files into a 2D list.

2005-05-11 Thread Oyvind Ostlund
I am not sure what the right syntax is here. So please help me out (started 2 days ago). I have a list of about 20 files that I want to read line by line into a 2D list. So the first dimension will be each file, and the second every line in that file. I tried to do something like this: f