[Tutor] A question
Rinzwind
w.damen at gmail.com
Sun Feb 5 10:30:47 CET 2006
On 2/5/06, Bian Alex <python.bian at gmail.com> wrote:
>
> How can I get a string from a random file.
> For Example:
> Del ete On : Copy
> Owner : Bn
> Personalized: 5
> PersonalizedName : My Documents
>
> I want to get the string after 'Owner' ( In example is 'Bn')
>
> 'import re' ?
>
> Pls help.
>
help <tutor at python.org>
You mean like this?
>>> line ='Owner:Bn'
>>> line = line.split(":")
>>> print line
['Owner', 'Bn']
>>> print line[1]
Bn
So you read the lines from the file till you find "Owner:Bn" and split it at
the ':'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060205/d72e96ca/attachment.html
More information about the Tutor
mailing list