search for pattern in StringList
moshez at zadka.site.co.il
Tue Dec 19 05:01:09 CET 2000
On Mon, 18 Dec 2000, Simon Brunning <SBrunning at trisystems.co.uk> wrote:
> myList = ['an', 'been', 'call', 'door']
> for i in range(0, len(myList)):
> if myList.find('a') <> -1:
> print i, myList[i]
for (i, element) in zip(range(myList), myList):
if 'a' in element:
print i, element
(Warning: zip was added in Python 2.0)
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus.
Please stop the spread of signature viruses!
More information about the Python-list