fbpx
Python初學程式

Python 常用數據類型 – 元組

前言 什麼是元組? 元組的使用與列表相似,不同之處在於元組是不可修改的,元組使用圓括號(  ),而列表使用中括弧。 大綱 定義元組 常用操作 一.定義元組 1. 使用逗號的方法: https://gist.github.com/Celia-code/0258748256705e006d27f2b8cd75129a   2. 使用圓括號的方法: https://gist.github.com/Celia-code/41a5d8e11450757f92269a2c0ad49fb2   3. 使用tuple函數:     範例:將一列表轉換為元組 https://gist.github.com/Celia-code/e36efa69ab3bf26aa5e85512a9a88439   4. 定義只有一個元素的元組:…
celia
May 11, 2020