(no subject)

Leeds, Mark mleeds at mlp.com
Fri Sep 19 10:16:37 EDT 2003


python : i am a python novice and i
am reading in a text file of say 500
lines with the fields in each line elimited by a "|" and
there are 90 records in each line.
 
my normal reading of text lines  algorithm
( using readlines, and then strip the "|" and then append into a list) 
seems to be working
strangely because it's
reading  all 500 lines in as one big list
instead of a list of lists like it usually does.
i guess the lines don't have the tabs or
returns that make python realize that
it's onto a new line.
unfortunately, the file was
created from a P.C and I use unix so it probably has something
to do with this.
 
so, my question is , is it possible
to take the one big list that
i have now and tell python
to take the fields in the list
and make a list of lists where
each sub list is composed of every 90
items in the list ? I imagine this
might be possible because
Python seems very powerful for
this type of stuff ? thanks.
i really appreciate it.
 
 
                            mark 
 
p.s : i was going to include part
of the file but then I realized that  i would have to transfer it back
to the 
pc ( because i only have pc email ) which defeats the whole purpose.
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030919/dcd18429/attachment.html>


More information about the Python-list mailing list