How to check if a tuple contains an element in Python?

前端 未结 3 954
灰色年华
灰色年华 2020-12-16 11:56

I tried to find the available methods but couldn\'t find it. There is no contains. Should I use index? I just want to know if the item exists, don\

3条回答
  •  隐瞒了意图╮
    2020-12-16 12:48

    if "word" in str(tuple):
    # You can convert the tuple to str too
    

    i has the same problem and only worked to me after the convert str()

提交回复
热议问题