Re: extracting numbers from a file, excluding words

2005-11-01 Thread Micah Elliott
On Nov 01, Mike Meyer wrote: > Kristina Kudriaðova <[EMAIL PROTECTED]> writes: > > > 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > >> Hi, I have a file with this content: > >> > >> z zzz z > >> ... > >> xxx xx x 34.215 > >> zzz zz > >> ..

Re: extracting numbers from a file, excluding words

2005-11-01 Thread Mike Meyer
Kristina Kudriaðova <[EMAIL PROTECTED]> writes: > 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: >> Hi, I have a file with this content: >> >> z zzz z >> ... >> xxx xx x 34.215 >> zzz zz >> ... >> > > Hi, > > I'd suggest doing this: > > f =

Re: extracting numbers from a file, excluding words

2005-11-01 Thread Jeffrey Schwab
Steve Horsley wrote: > Kristina Kudriašova wrote: > >> 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: >> >>> Hi, I have a file with this content: >>> >>> z zzz z >>> ... >>> xxx xx x 34.215 >>> zzz zz >>> ... >>> >> >> Hi, >> >> I'd suggest

Re: extracting numbers from a file, excluding words

2005-11-01 Thread Steve Horsley
Kristina Kudriašova wrote: > 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: >> Hi, I have a file with this content: >> >> z zzz z >> ... >> xxx xx x 34.215 >> zzz zz >> ... >> > > Hi, > > I'd suggest doing this: > > f = file('...') > for l

Re: extracting numbers from a file, excluding words

2005-11-01 Thread Kristina Kudriašova
1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Hi, I have a file with this content: > > z zzz z > ... > xxx xx x 34.215 > zzz zz > ... > Hi, I'd suggest doing this: f = file('...') for line in f: if 'xxx xx x' in line

extracting numbers from a file, excluding words

2005-11-01 Thread dawenliu
Hi, I have a file with this content: z zzz z ... xxx xx x 34.215 zzz zz ... "x" and "z" are letters. The lines with "z" are trash, and only the lines with "x" are important. I want to extract the number (34.215 in this case) behind the letters x, and store i