Parsing Hints
Kent Johnson
kent at kentsjohnson.com
Fri Mar 17 15:39:17 EST 2006
mwt wrote:
> Hi -
> I'm working on parsing a file that has data that looks like the sample
> below.
>
> Here's a sample of the data:
>
> Index 4: folding now
> server: 171.65.199.158:8080; project: 1809
> Folding: run 17, clone 19, generation 35; benchmark 669; misc: 500,
> 400
> issue: Wed Mar 15 18:32:19 2006; begin: Wed Mar 15 18:32:25 2006
> due: Fri Apr 28 19:32:25 2006 (44 days)
> core URL: http://www.stanford.edu/~pande/Linux/x86/Core_82.fah
> CPU: 1,0 x86; OS: 4,0 Linux
> assignment info (le): Wed Mar 15 18:32:19 2006; A0F3AAD2
> CS: 171.65.103.100; P limit: 5241856
> user: MWT; team: 0; ID: 1A2BFB777775B7B; mach ID: 2
> work/wudata_04.dat file size: 82814; WU type: Folding at Home
> Average download rate 97.552 KB/s (u=4); upload rate 38.718 KB/s (u=3)
> Performance fraction 0.950453 (u=3)
You don't say what data you are trying to extract. If it is key:value
pairs where the key is everything before the first colon, just use
line.split(':', 1) to split on just the first colon.
Kent
More information about the Python-list
mailing list