在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 pythontab: print 'w is not in pythontab'
in 和 not in 长短经常用的要害字。
感激@飞飞指正错误
在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 pythontab: print 'w is not in pythontab'
in 和 not in 长短经常用的要害字。
感激@飞飞指正错误