在python中可以通过in和not in关键字来判读一个list中是否包含一个元素

pythontab = ['p','y','t','h','o','n','t','a','b']
if 't' in pythontab:
print 't in pythontab'
if 'w' not in theList:
print 'w is not in pythontab'

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-11-07
相关资源
相似解决方案