Python check if Items are in list

前端 未结 4 922
慢半拍i
慢半拍i 2021-01-20 14:01

I am trying to iterate through two lists and check if items in list_1 are in list_2. If the item in list_1 is in list_2 I would like to print the item in list_2. If the ite

4条回答
  •  感动是毒
    2021-01-20 14:09

    for i in range(len(list_1)):
      if list_1[i] in list_2[i]:
        print(list_2[i])
      else:
        print(list_1[i])
    

提交回复
热议问题