Newby Question for reading a file

2009-02-19 Thread steven.oldner
Simple question but I haven't found an answer. I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure, and then do something to the fields. That's my mental reference. How do I separate or address each field in the file line with

Re: Newby Question for reading a file

2009-02-19 Thread Mike Driscoll
On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure, and then do something to the fields.  That's my mental

Re: Newby Question for reading a file

2009-02-19 Thread steven.oldner
On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure,

Re: Newby Question for reading a file

2009-02-19 Thread Curt Hash
On Thu, Feb 19, 2009 at 12:07 PM, steven.oldner steven.old...@gmail.com wrote: On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer. I program in ABAP, and in ABAP

Re: Newby Question for reading a file

2009-02-19 Thread Peter Otten
steven.oldner wrote: On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file

Re: Newby Question for reading a file

2009-02-19 Thread steven.oldner
On Feb 19, 1:44 pm, Curt Hash curt.h...@gmail.com wrote: On Thu, Feb 19, 2009 at 12:07 PM, steven.oldner steven.old...@gmail.com wrote: On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I

Re: Newby Question for reading a file

2009-02-19 Thread alex23
On Feb 20, 5:38 am, Peter Otten __pete...@web.de wrote: Yes you can get portions of the line by slicing: for line in open(infile):     if line[8:18] != line[18:28]:             print line, You can also name the slices, which makes the code more clear (IMO): endda = slice(8,18) begda =

Re: Newby Question for reading a file

2009-02-19 Thread Steve Holden
alex23 wrote: On Feb 20, 5:38 am, Peter Otten __pete...@web.de wrote: Yes you can get portions of the line by slicing: for line in open(infile): if line[8:18] != line[18:28]: print line, You can also name the slices, which makes the code more clear (IMO): endda =