我正在检查 state_list
中的州名称是否存在于 address
列表中。我尝试了以下方法,但没有用。
state_list = ['VIC', 'WA']
address = ['Unit 6, Traeger Court Business Park 28 Thynne', 'Street', 'BRUCE, ACT, 2617', 'AUSTRALIA']
for state in state_list:
for a in address:
if state in a:
print(state)
答案 0 :(得分:1)
'VIC' 'WA'
它们都不在您的地址列表中
答案 1 :(得分:0)
你的代码看起来不错。您在地址列表中没有任何地址具有状态列表中的任何状态。添加一个包含 state_list 中的 state 的新地址并再次检查