我讓用戶輸入他們的電子郵件地址。但是,我假設 Python 無法識別特殊字符“@”,但我不確定重新編碼/讓用戶輸入如何將該特殊字符識別為字符串的一部分。import smtplibsender_email = "[email protected]"rec_email = input('Enter a email to send to: ')password = "Password"SUBJECT = "Subject Line Test"TEXT = "Test Text"message = 'Subject: {}\n\n{}'.format(SUBJECT, TEXT)server = smtplib.SMTP('smtp.gmail.com', 587)server.starttls()server.login(sender_email, password)print("Login success")server.sendmail(sender_email, rec_email, message)print("Email has been ent to ", rec_email)server.quit()我該如何糾正這個問題?#Error: using [email protected] as my inputTraceback (most recent call last): File "testss.gyp", line 4, in <module> rec_email = input('Enter a email to send to: ') File "<string>", line 1 [email protected] ^SyntaxError: invalid syntax
具有唯一字符的 Python 字符串?無效的語法
慕碼人8056858
2023-03-08 14:39:57