* str_igrep(): use enumerate function.

This commit is contained in:
Wirawan Purwanto
2012-06-13 19:36:35 -04:00
parent d70bcf2149
commit 7ebb4004dc

View File

@@ -140,7 +140,8 @@ def str_grep(S, strs):
def str_igrep(S, strs):
"""Returns a list of the indices of the strings wherein the substring S
is found."""
return [i for (s,i) in zip(strs,xrange(len(strs))) if s.find(S) >= 0]
return [i for (i,s) in enumerate(strs) if s.find(S) >= 0]
#return [i for (s,i) in zip(strs,xrange(len(strs))) if s.find(S) >= 0]
def slice_str(s):