[Tutor] searching for multiple strings in line.starswith()

Bala subramanian bala.biophysics at gmail.com
Mon Jul 19 18:18:54 CEST 2010


Friends,
I have to extract the line from a file that does not contain a set of
strings in the start of the line, i wrote the following code.

for index, line in enumerate(myvar.split('\n')):
    if line.startswith('') not in ['#Cluster','#Centroid','#End']:
        line=line.split()
        print line

The code works without error but it seems that the condition is not applied.
What is the correct way of searching for multiple strings at the start of a
line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100719/d0139dba/attachment.html>


More information about the Tutor mailing list