Python: Find in list

后端 未结 10 724
故里飘歌
故里飘歌 2020-11-22 10:15

I have come across this:

item = someSortOfSelection()
if item in myList:
    doMySpecialFunction(item)

but sometimes it does not work with

10条回答
  •  醉酒成梦
    2020-11-22 10:47

    Check there are no additional/unwanted whites space in the items of the list of strings. That's a reason that can be interfering explaining the items cannot be found.

提交回复
热议问题