最近在学习笨办法学python,由于安装的是python3,而教程使用的是python2,所以在代码部分有些会有差别导致编译出现问题,以此记录。

#python3
print
(" Hello world!") print (3 + 2 + 1 - 5 + 4 % 2 - 1 /4 + 6) print ("what is 3 + 2?",3 + 2)
python2
print
"Hello world!" print 3 + 2 + 1 - 5 + 4 % 2 - 1 /4 + 6 print "what is 3 + 2?",3 + 2

 

#python3
print
(formatter % ( "I had this thing.", "That you could type up right.", "But it didn't sing.", "So I said goodnight." ))
#python2
print
formatter % ( "I had this thing.", "That you could type up right.", "But it didn't sing.", "So I said goodnight." )
#python3
print
((end1 + end2 +end3 + end4 + end5 + end6), (end7 + end8 +end9 + end10 + end11 + end12))
#python2
print
end1 + end2 +end3 + end4 + end5 + end6, print end7 + end8 +end9 + end10 + end11 + end12
#python3
print
("." * 10 )# what'd that do?
end1 = "C"
#Python2
print
"." * 10 # what'd that do? end1 = "C"

 

#Python2
print
""" There's something going on here. With the three double-quotes. We'll be able to type as much as we like. Even 4 lines if we want,or 5,or 6. """

 

#Python3
print
(""" There's something going on here. With the three double-quotes. We'll be able to type as much as we like. Even 4 lines if we want,or 5,or 6. """)

 

 posted on 2020-04-03 13:26  yi'duo'yun  阅读(515)  评论(0编辑  收藏  举报