python实现检查邮箱格式是否正确,并检查提交的文件格式是否正确

代码实现功能:

  1. 输入邮箱账号,检查邮箱格式是否正确,是否含有@字符,且以 .com结尾
  2. 输入提交文件名,检查提交的文件格式是否正确,是否以 .py结尾
email  = input("Please input your email: ")
while ( email.find("@") == -1 or not email.endswith('.com')):
    print("Wrong Email")
    email = input("Please input your email: ")
file = input("Please input your file: ")
while(not file.endswith('.py')):
    print('Wrong File')
    file = input("Please input your file: ")
print("Pass!")
发布了84 篇原创文章 · 获赞 10 · 访问量 8586

猜你喜欢

转载自blog.csdn.net/AK47red/article/details/103696229
今日推荐