<br><br><div><span class="gmail_quote">On 2/5/06, <b class="gmail_sendername">Bian Alex</b> <<a href="mailto:python.bian@gmail.com">python.bian@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>How can I get a string from a random file. </div>
<div>For Example:</div>
<div>Del ete On : Copy<br>Owner : Bn<br>Personalized: 5<br>PersonalizedName : My Documents</div>
<div> </div>
<div>I want to get the string after 'Owner' ( In example is 'Bn')</div>
<div> </div>
<div>'import re' ?</div>
<div> </div>
<div>Pls help.</div></blockquote>help <<a href="mailto:tutor@python.org">tutor@python.org</a>></div><br>You mean like this?<br><br>>>> line ='Owner:Bn'<br>>>> line = line.split(":")<br>>>> print line
<br>['Owner', 'Bn']<br>>>> print line[1]<br>Bn<br><br><br>So you read the lines from the file till you find "Owner:Bn" and split it at the ':'.<br>