为什么Python在没有打印命令时打印\,但在打印命令时不打印?我知道这可能只是它的工作方式,但如果有一些逻辑可以很好地了解。
>>> '"Isn\'t," she said.'
'"Isn\'t," she said.'
>>> print('"Isn\'t," she said.')
"Isn't," she said.
感谢。
JT
答案 0 :(得分:0)
直接在编辑器中输入时,就像说“这是我想要输出的确切值”。当您调用print函数时,它会“处理”该变量以打印出应该的样子