【发布时间】:2011-08-17 01:34:39
【问题描述】:
我知道可以使用string.find() 在字符串中查找子字符串。
但是在不使用循环的情况下找出其中一个数组项是否在字符串中匹配子字符串的最简单方法是什么?
伪代码:
string = 'I would like an apple.'
search = ['apple','orange', 'banana']
string.find(search) # == True
【问题讨论】:
标签: python arrays string find match