區別一:print語法使用
python2.7print語法使用>>>print"HelloPython"
Python3.7print語法使用>>>print("HelloPython")
區別二:raw_input()和input()
Python2.7raw_input()input()都存在可使用raw_input()接收字符串stringinput()接收數字int/flot.
Python3.7raw_input()不存在僅存在input()兩者合并接收任意格式返回string
區別三:函數cmp()
python2.7cmp(x,y)函數用于比較2個對象,如果x
python3.7cmp()已經不存在了,如果你需要實現比較功能,需要引入operator模塊,適合任何對象
以上內容為大家介紹了Python2與Python3的主要區別,希望對大家有所幫助,如果想要了解更多Python相關知識,請關注IT培訓機構:千鋒教育。