判断字符串是否是电子邮箱地址

img

谢谢大佬。
千万别是高难度的,就是最基础的那种就行,我刚学到第8讲

img


email = input("请输入邮箱:")
index1 = email.find("@")
index2 = email.find(".")
if index1 != -1 and index2 != -1 and index1 < index2:
    print("正在发送邮件哟!")
    name,c,address = email.partition("@")
    print("接受者姓名: {},发送的目的地: {}".format(name,address))
else:
    print("不符合重新录入")

img

如果觉得答案对你有帮助,请点击下采纳,谢谢~

s=input()
if s.find('@')<s.find('.'):
    print(f"{s.partition('@')[0]}正在发送邮件哦")
else:
    print('不合格,重新录入')

img