Re: [Tutor] how to extract data only after a certain condition is met

2010-10-10 Thread bob gailer
Emile beat me to it, but here goes anyway... On 10/10/2010 3:35 PM, Josep M. Fontana wrote: Hi, First let me apologize for taking so long to acknowledge your answers and to thank you (Eduardo, Peter, Greg, Emile, Joel and Alan, sorry if I left anyone) for your help and your time. One of th

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-10 Thread Emile van Sebille
On 10/10/2010 12:35 PM Josep M. Fontana said... OK. Let's start with -b- . My first problem is that I don't really know how to go about building a dictionary from the file with the comma separated values. I've discovered that if I use a file method called 'readlines' I can create a list whose el

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-10 Thread Josep M. Fontana
Hi, First let me apologize for taking so long to acknowledge your answers and to thank you (Eduardo, Peter, Greg, Emile, Joel and Alan, sorry if I left anyone) for your help and your time. One of the reasons I took so long in responding (besides having gotten busy with some urgent matters related

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Emile van Sebille
On 10/6/2010 11:58 AM Joel Goldstick said... On Wed, Oct 6, 2010 at 2:50 PM, Emile van Sebille wrote: On 10/6/2010 9:25 AM Eduardo Vieira said... Of course this solution is simpler: extracted = a[a.index("i")+1:] But I didn't want to build a list in memory with "readlines()" in the case

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Joel Goldstick
On Wed, Oct 6, 2010 at 2:50 PM, Emile van Sebille wrote: > On 10/6/2010 9:25 AM Eduardo Vieira said... > > > > Of course this solution is simpler: >> extracted = a[a.index("i")+1:] >> But I didn't want to build a list in memory with "readlines()" in the >> case of a file. >> > > This is what I

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Emile van Sebille
On 10/6/2010 9:25 AM Eduardo Vieira said... Of course this solution is simpler: extracted = a[a.index("i")+1:] But I didn't want to build a list in memory with "readlines()" in the case of a file. This is what I do unless the files are _really big_ For-me-really-big-is-over-200Mb-ish-ly y'rs

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Alan Gauld
"Eduardo Vieira" wrote The other day I was writing a script to extract data from a file from the line where a text is found to the end of the file. The standard pattern here is to use a sentinel, in pseudo code: def checkLine(line, start='',end=''): if (start in line) or (end in line):

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Knacktus
Am 06.10.2010 18:25, schrieb Eduardo Vieira: The other day I was writing a script to extract data from a file from the line where a text is found to the end of the file. The same functionality is this sed script: '1,/regexp/'d I couldn't put my head to work around this and came up with a solution

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Peter Otten
Eduardo Vieira wrote: > The other day I was writing a script to extract data from a file from > the line where a text is found to the end of the file. The same > functionality is this sed script: > '1,/regexp/'d > I couldn't put my head to work around this and came up with a solution > using list

[Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Eduardo Vieira
The other day I was writing a script to extract data from a file from the line where a text is found to the end of the file. The same functionality is this sed script: '1,/regexp/'d I couldn't put my head to work around this and came up with a solution using list slicing. But how can I do that? I w