# 5-9 处理没有用户的情形
users=[]
if users:
for user in users:
if user=='admin':
print("Hello admin,would you like to see a status report?")
else:
print("Hello "+user+",thank you for logging in again")
else:
print("We need to find some users!")
# 请问这段代码里 第一个else不包括列表为空的情况吗? 还是这段代码是错的?
在python中,列表数据量为0,没有元素的时候,可以用作bool值的False,字符串无字符,长度为0时,也一样