[英]I want to go thought list with if to check if multiple elements are equal to that I want
我想做这样的事情:
if board[0:2] == choice:
#the code here
所以我想要做的是遍历从0到2的元素,并检查它们是否等于“选择”,但是我不知道该怎么做。 请帮忙!
for item in board[0:2]:
if item==choice:
#the code here
如果您的元素是可哈希的,请使用set
:
st = set(choice)
if st.issuperset(board[0:2]):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.