extracting numbers from a file, excluding words

dawenliu at gmail.com dawenliu at gmail.com
Tue Nov 1 12:19:45 EST 2005


Hi, I have a file with this content:

zzzz zzzzz zzz zzzzz
...
xxxxxxx xxxxxxxxxx xxxxx 34.215
zzzzzzz zz zzzz
...

"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 it in a file.

The sentence "xxxxxxx xxxxxxxxxx xxxxx " is FIXED and KNOWN. The "z"
sentences are can vary.  There are also unknown number of "z" lines.

Any suggestions will be appreciated.




More information about the Python-list mailing list