iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 8
1
Data Technology

Python學習筆記系列 第 8

[Day 8] Lists 串列

List是一種有序列的資料結構,list中的每個物件用逗號區隔,並用中括號將元素包起來。

以下我們介紹如何使用List

https://ithelp.ithome.com.tw/upload/images/20171211/20107290JIgmSAtBEN.png


索引操作和切片操作

https://ithelp.ithome.com.tw/upload/images/20171211/20107290GPFJ0hEKxA.png


Python的List很彈性,沒有固定數量,亦沒有最大數量的限制

https://ithelp.ithome.com.tw/upload/images/20171211/20107290WwfFC6WmoG.png


https://ithelp.ithome.com.tw/upload/images/20171211/20107290FZgG0eFcm0.png


Python也有巢狀結構,所以可以把list放在另一個list裡面

串列綜合運算讓我們可以用快速建構一個list,常見的應用是基於一個 list 或可列舉物件,將每一個元素經過某個運算的結果串接起來成為一個新的 list

https://ithelp.ithome.com.tw/upload/images/20171211/201072903mOH5XRkmn.png

資料來源: Go from zero to hero in Python


上一篇
[ Day7 ] 格式化輸出
下一篇
[Day9 ] Dictionary字典
系列文
Python學習筆記14
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言