我想验证用户在我的程序中输入的数据(一个电子邮件地址)。如果用户输入“@”符号,程序应该接受它。如果没有,程序应该循环并再次要求电子邮件。到目前为止,我已经尝试这样做了,但是对于输入的每个字符,程序循环:
emailright = True
while emailright == True:
email = input("Please enter your email address")
character = ("@")
for character in email:
if character == '@':
print("Your email address had been registered")
emailright = True
else:
print("invalid email address, please re-enter")
emailright = Falsewhile循环及其内部的所有内容也都已缩进。谢谢!
发布于 2017-02-15 15:37:33
https://stackoverflow.com/questions/42253664
复制相似问题