我正在尝试为自己编写登录和注册脚本,但是我的用户名定义存在问题。我可以在没有任何一种验证方法的情况下运行该代码,但是有了它,代码似乎总是坏了。
usernameloop = 1
while usernameloop == 1:
username = input("Please input your desired username.")
if len(username) >> 20:
print("Unable to choose that username, you need to have less than 20 characters in your username.")
elif len(username) >= 4 and len(username) <= 20:
print("Username Selected. Your username is:", username)
time.sleep(1)
usernameloop = 0
break
# This is the problematic statement. It doesn't work if this is in and always goes to this statement even if the validation should be correct.
elif len(username) << 4:
print("Unable to choose that username, you need 3 or more characters in your username.")
else:
print("An Unknown Error Occurred, contact x with the screenshot of the conversation history.")
time.sleep(10)
exit()
有人知道为什么它不起作用吗,我不知道为什么它不起作用。
答案 0 :(得分:2)
使用单个“ <”或“>”代替“ <<”或“ >>”,没关系。
答案 1 :(得分:0)