Compare string with all values in array

前端 未结 4 744
小鲜肉
小鲜肉 2020-12-09 02:54

I am trying to fumble through python, and learn the best way to do things. I have a string where I am doing a compare with another string to see if there is a match:

4条回答
  •  忘掉有多难
    2020-12-09 03:19

    I assume you mean list and not array? There is such a thing as an array in Python, but more often than not you want a list instead of an array.

    The way to check if a list contains a value is to use in:

    if paid[j] in d:
        # ...
    

提交回复
热议问题