# Python -log ###### tags: `Log` ## 2021 . 3 . 28 ### (前言) . 容器結構 #### ```Python``` 中的容器 : - ```List``` : 動態data type的array。 - ```Tuple``` : ```immutable``` 的List。 - ```Dict``` : mapping,Key不能重複,同一個Key不可以有多個value。 - ```Set``` : Collection of distinct Object,沒有key-value pair(set不是relation)。 ### (一) . Tuple - 由數學上的定義了解 : ```a finite ordered list (sequence) of elements.``` 1. ```finite``` : ```Fixed Length```,長度固定,不可以變動。 2. ```Order List``` : 就是數學上的數列,所以也不可以更動內部元素(immtable),但是可以重複元素存在(Duplicates)。 - 和record的關係 : 很像,但定義的用途不一樣。 1. ```Record``` : ```collection of fields```,database中的row 2. ```Fields ``` : database中的col。 - 在程式語言上的特性 : 1. 固定長度。 2. 不可以更改內部元素。 3. 可以重複元素儲存。 ### (二). Dict - 由數學上理解 : ```Mapping```,兩個set的relation。 1. 不可以有Duplicates key 。 2. 可以多個key對上一個value。 3. 不可以一個key有多個value。 ### (三) . Set - 由數學上了解 : ```Collection of distinct Object``` 。 1. 沒有key,只有value。 2. 不可以有Duplicates value。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up