[英]How to put a " inside of a variable python
我最近一直在尝试制作一个加密程序,但我弄不清楚如何在变量(本例中为“字母”)中放置双引号。 目前,我除了“”和Tab键外,还拥有所有需要的字符,请记住我只是一个初学者,我们将不胜感激。-谢谢!
while True:
plaintext = input('Enter messege: ')
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,!?#@$%^&*()-_=+[]{}|\:;`~<>/ '"
key = not telling you what I am
cipher = ''
for c in plaintext:
if c in alphabet:
cipher += alphabet[(alphabet.index(c)+key)%(len(alphabet))]
print ('your encrypted message is: ' + cipher)
您可以使用\\"
样品:
print ("Hello \"")
输出:
Hello "
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.