更新时间:2022-11-14 12:09:01
是的,对于初学者来说,不需要范围
Yes, no need for range, for starters
for hay in haystack:
if needle in hay:
return hay
如果您确实需要索引,请使用enumerate
And if you really really need the index, use enumerate
for x, hay in enumerate(haystack):
if needle in hay:
return x