网络编程
位置:首页>> 网络编程>> Python编程>> Python 查看list中是否含有某元素的方法

Python 查看list中是否含有某元素的方法

作者:Recar  发布时间:2023-07-29 21:46:08 

标签:Python,list,某元素

用关键字 in 和not in 来

如下:


qwe =[1,2,3,4,5]
if 2 in qwe:
print ‘good!'
else:
print ‘not good'

来源:https://blog.csdn.net/qq_28295425/article/details/52444226

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com