代码:
city=['深圳','上海','北京','杭州']
address='我家住在大中国的杭州'
if any(element in address for element in city):
print("字符串“%s”包含city内的字符串"%address)
输出:
代码:
city=['深圳','上海','北京','杭州']
address='我家住在大中国的杭州'
if any(element in address for element in city):
print("字符串“%s”包含city内的字符串"%address)
输出: