a string problem
Mitja Trampus
nun at example.com
Tue Jun 13 12:13:48 EDT 2006
John Salerno wrote:
> micklee74 at hotmail.com wrote:
>> hi
>>
>> if i have a some lines like this
>> a ) "here is first string"
>> b ) "here is string2"
>> c ) "here is string3"
>>
>> When i specify i only want to print the lines that contains "string" ie
> ...
> And I'm actually ashamed to admit that I know the RE way, but not the
> regular string manipulation way, if there is one! This seems like
> something easy enough to do without REs though.
I'd just split it on whitespace, just like with the RE:
if "string" in "here is first string".split(): ...
More information about the Python-list
mailing list