1. 程式人生 > >Python 2 和Python 3的區別

Python 2 和Python 3的區別

put 運行 標示 odin input raw 強調 pytho 輸入

Python 2 和Python 3 的區別:

1. 直接運行python,其實是調用的python2,輸入python3 ,其實是調用的是python3

2. 在python 2中需要提前標示出utf-8 的中文輸入字符,# -*- coding: utf-8 -*- 或 #coding=utf-8 , 但是在python 3中可以直接輸入,不用強調有中文;

3. 在python 2 和python 3中,在input 功能上有很大的區別,在python 中,input 是直接運算。

  python 2 中用raw_input

  python 3 中可以直接用 input

Python 2 和Python 3的區別