1. 程式人生 > >python---基礎知識回顧(其他)

python---基礎知識回顧(其他)

its 入棧 eve license amd bsp python3.5 help none

一:語句中的入棧順序

同其他語言(C,C++等)一樣入棧順序是右端先進行執行後入棧(python3.5中),在python2.7之前的入棧順序是左端先

Python2.7:

Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.

>>> ls = [1,2,3]
>>> print ls,ls.reverse()  #print先入棧執行,然後reverse再入棧執行
[
1, 2, 3] None   >>> print ls [3, 2, 1]

Python3.5:

Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> li = [4,3]
>>> print(li,li.reverse())  #右端先入棧執行reverse,再輸出li,li.reverse()的結果None
[
3, 4] None >>> print(li) [3, 4]

python---基礎知識回顧(其他)