Re: Reading by positions plain text files

2010-12-13 Thread javivd
On Dec 12, 11:21 pm, Dennis Lee Bieber wrote: > On Sun, 12 Dec 2010 07:02:13 -0800 (PST), javivd > declaimed the following in > gmane.comp.python.general: > > > > > f = open(r'c:c:\somefile.txt', 'w') > > > f.write('0123456789\n0123456789\n0123456789') > >         Not the most explanatory sample

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, Tim Harig wrote: >> I used .seek() in this manner, but is not working. > > It is working the way it is supposed to. > If you want the absolute position in a column: > > f = open('somefile.txt', 'r').read().splitlines() > for column in f: > variable = column

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, javivd wrote: > On Dec 1, 7:15 am, Tim Harig wrote: >> On 2010-12-01, javivd wrote: >> > On Nov 30, 11:43 pm, Tim Harig wrote: >> >> encodings and how you mark line endings.  Frankly, the use of the >> >> world columns in the header suggests that the data *is* separated by >> >>

Re: Reading by positions plain text files

2010-12-12 Thread javivd
On Dec 1, 7:15 am, Tim Harig wrote: > On 2010-12-01, javivd wrote: > > > > > > > > > > > On Nov 30, 11:43 pm, Tim Harig wrote: > >> On 2010-11-30, javivd wrote: > > >> > I have a case now in wich anotherfilehas been provided (besides the > >> > database) that tells me in wich column of thefilei

Re: Reading by positions plain text files

2010-12-03 Thread javivd
On Dec 1, 3:15 am, Tim Harig wrote: > On 2010-12-01, javivd wrote: > > > > > On Nov 30, 11:43 pm, Tim Harig wrote: > >> On 2010-11-30, javivd wrote: > > >> > I have a case now in wich another file has been provided (besides the > >> > database) that tells me in wich column of the file is every

RE: Reading by positions plain text files

2010-12-01 Thread Javier Van Dam
Ok. I will try it and let you know. Thanks a lot!! J > Date: Tue, 30 Nov 2010 20:32:56 -0600 > From: python.l...@tim.thechases.com > To: javiervan...@gmail.com > CC: python-list@python.org > Subject: Re: Reading by positions plain text files > > On 11/30/2010 08:03 PM, jav

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-12-01, javivd wrote: > On Nov 30, 11:43 pm, Tim Harig wrote: >> On 2010-11-30, javivd wrote: >> >> > I have a case now in wich another file has been provided (besides the >> > database) that tells me in wich column of the file is every variable, >> > because there isn't any blank or tab

Re: Reading by positions plain text files

2010-11-30 Thread Tim Chase
On 11/30/2010 08:03 PM, javivd wrote: On Nov 30, 11:43 pm, Tim Harig wrote: VARIABLE NAME POSITION (COLUMN) IN FILE var_name_1 123-123 var_name_2 124-125 var_name_3 126-126 .. .. var_name_N 512-513 (last positions) and no,

Re: Reading by positions plain text files

2010-11-30 Thread MRAB
On 01/12/2010 02:03, javivd wrote: On Nov 30, 11:43 pm, Tim Harig wrote: On 2010-11-30, javivd wrote: I have a case now in wich another file has been provided (besides the database) that tells me in wich column of the file is every variable, because there isn't any blank or tab character tha

Re: Reading by positions plain text files

2010-11-30 Thread javivd
On Nov 30, 11:43 pm, Tim Harig wrote: > On 2010-11-30, javivd wrote: > > > I have a case now in wich another file has been provided (besides the > > database) that tells me in wich column of the file is every variable, > > because there isn't any blank or tab character that separates the > > vari

Re: Reading by positions plain text files

2010-11-30 Thread MRAB
On 30/11/2010 21:31, javivd wrote: Hi all, Sorry, newbie question: I have database in a plain text file (could be .txt or .dat, it's the same) that I need to read in python in order to do some data validation. In other files I read this kind of files with the split() method, reading line by lin

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-11-30, javivd wrote: > I have a case now in wich another file has been provided (besides the > database) that tells me in wich column of the file is every variable, > because there isn't any blank or tab character that separates the > variables, they are stick together. This second file sp