| >>> [valid for valid in f.readlines() if valid.startswith('abc') or
| valid.startswith('123') or valid.startswith('ff5')]
|
| how to modify startswith in order to make it accept a list instead
of
| a simple string?
|
| [valid for valid in f.readlines() if valid.startswith(['abc', '123',
'ff5'])]
If the strings are all three chars you could do:
[valid for valid in f if valid[:3] in ['abc', '123', 'ff5'] ]
HTH,
Alan G.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor