>>> list(range(1,6))
[1, 2, 3, 4, 5]
>>> [x for x in range(1,6)]
[1, 2, 3, 4, 5]
-----------------------
>>> [x for x in range(1,6,2)]
[1, 3, 5]
>>> list(range(1,6,2))
[1, 3, 5]
-----------------------
a = "abc"
b = "bcde"
-----------------------
set(a)
{'c', 'a', 'b'}
set(b)
{'c', 'd', 'e', 'b'}
-----------------------
set(a) & set(b) # & 取共有值
{'c', 'b'}
等同于 a.intersection(b)
-----------------------
set(a) | set(b) # | 取全部值
{'a', 'e', 'c', 'd', 'b'}
等同于 a.union(b)
-----------------------
set(a) - set(b) # | 取 a 中 b 没有的值
{'a'}
等同于 a.difference(b)
-----------------------
set(a) ^ set(b) # | 取非共有值
{'a', 'e', 'd'}
--------------------------------------------
ord("a") # function ord convert letter to ASCII number, reverse chr
97
ord("z")
122
ord("A")
65
ord("Z")
90
-----------------------
chr(97) # function chr convert ASCII number to letter, reverse ord
'a'
chr(65)
'A'
chr(122)
'z'
chr(90)
"Z"
-----------------------
hex(100) # function hex convert number to hexadecimal string
'0x64'
-----------------------
oct(90) # function oct convert number to octal string
'0o132'