我有list_a
和string_tmp
个这样的
list_a = ['AA', 'BB', 'CC']
string_tmp = 'Hi AA How Are You'
我想知道list_a
中有没有string_tmp
个项目,如果有,是type = L1
还是type = L2
?
# for example
type = ''
for k in string_tmp.split():
if k in list_a:
type = 'L1'
if len(type) == 0:
type = 'L2'
这是真正的问题,但在我的项目中,len(list_a) = 200,000
和len(strgin_tmp) = 10,000
,所以我需要102
# this is the output of the example
type = 'L1'