[Personal memo] Python sequence type / mapping type

--Sequence type --List --Tuple --Mapping type --Dictionary

Sequence type

list

How to define a list


[value1, value2, value3, ... , valueN]

Tuple

Tuple


(value1, value2, ..., valueN)

set

Data type that does not allow duplicate elements

set


{Element 1,Element 2,Element 3, ...,Element n}

Manipulation of sets

function Contents
add(element) elementを追加
remove(element) elementを削除
clear() Empty the set

Set arithmetic

notation Contents
set1 | set2 sum
set1 & set2 product
set1 - set2 difference
set1 ^ set2 Exclusive OR?

Mapping type

dictionary

So-called associative array, hash.

How to define a dictionary


{
     key1 : value1,
     key2 : value2,
     ...
     keyN : valueN
}

Recommended Posts

[Personal memo] Python sequence type / mapping type
Python data type summary memo
python memo
[Personal memo] Python virtual environment command memo
Python memo
python memo
Python memo
Python memo
[OpenCV] Personal memo
[Python] Memo dictionary
Python numeric type
python beginner memo (9.2-10)
python beginner memo (9.1)
★ Memo ★ Python Iroha
[Python] EDA memo
[My memo] python
Python2 string type
Python3 metaclass memo
Python personal Q.A
python personal notes
Python # string type
[Python] Basemap memo
Python beginner memo (2)
[Python] Numpy memo
[Personal memo] julia --Using Python library with julia using PyCall
python memo: Treat lists as a set type
[Keras] Personal memo to classify images by folder [Python]
Python class (Python learning memo ⑦)
python openCV installation (memo)
Python module (Python learning memo ④)
missingintegers python personal notes
Visualization memo by Python
Fibonacci sequence using Python
Python callable type specification
Python test package memo
[Python] Memo about functions
Python memorandum (personal bookmark)
python regular expression memo
Binary search (python2.7) memo
[My memo] python -v / python -V
The pain of gRPC using Python. November 2019. (Personal memo)
Python3 List / dictionary memo
[Memo] Python3 list sort
Python Tips (my memo)
[Personal notes] Python, Django
DynamoDB Script Memo (Python)
Python basic memo --Part 2
python recipe book Memo
Basic Python command memo
Python OpenCV tutorial memo
Python memo using perl-Dictionary type (case is not valid)
Python basic grammar memo
TensorFlow API memo (Python)
Check Python # type identity
python useful memo links
Python decorator operation memo
Python basic memo --Part 1
Effective Python Memo Item 3
Divisor enumeration Python memo
[Introduction to cx_Oracle] (Part 6) DB and Python data type mapping
Display character strings without line breaks in python (personal memo)