python---list判断
# 判断元素
# in
usernames=["admin","test","xiaohei"]
usernames=input("username:")
if usernames in usernames:
print("输入的用户存在")
# not in 不存在
if usernames not in usernames:
print("输入的用户不存在")
#for循环
for usernames in usernames:
print(usernames)
# index 原始通过循环下标来取值
for index in range(3):#0.1.2
print(usernames[index])

浙公网安备 33010602011771号