最近我在python中尝试了一些练习程序,我遇到了这个小问题.
当我输入
print ""
Run Code Online (Sandbox Code Playgroud)
在IDLE中,python shell打印了一个空字符.
如果我输入
print """"""
Run Code Online (Sandbox Code Playgroud)
在IDLE中,python shell打印了一个空字符.
但如果我输入,python shell会等待输入
print """"
Run Code Online (Sandbox Code Playgroud)
为什么会出现这种行为.据我所知,它也应该为此打印空字符print """".
Unk*_*own 11
在python中,您可以使用1或3引号括起来的字符串.
print "a"
print """a"""
Run Code Online (Sandbox Code Playgroud)
在您的情况下,解释器正在等待最后的三重报价.