没有什么能够阻挡,你对自由的向往。

Month August 2016

Python 列表

创建一个空列表

a = []

list 切片

L = ['a', 'b', 'c']

取第一个元素 list索引从0开始

L[0]

第二个

L[1]

第三个

L[2]

浅拷贝 L[:]实际上复制出了一个新list

L[:]

取所有元素

L[0:3]

索引从0开始可以省略[……]

Read more

© 2025 laowang's blog — Powered by WordPress

Theme by Anders NorenUp ↑