标签:列表 区分大小写 lower users 老用户 asn print name 复制
usernames = [‘admin‘,‘Tom‘,‘john‘,‘jack‘,‘philip‘]
usernames_copy = usernames[:] #复制列表操作
for i in range(0,len(usernames_copy)): #更改列表操作
usernames_copy[i] = usernames_copy[i].lower()
newusers = [‘A‘,‘B‘,‘C‘,‘D‘,‘tom‘]
for newuser in newusers:
if newuser.lower() in usernames_copy:
print(‘This username has been used‘)
else:
print("This username hasn‘t been used")
标签:列表 区分大小写 lower users 老用户 asn print name 复制
原文地址:https://www.cnblogs.com/yhzhao1/p/13334491.html