in / not in
索引和切片
注: 运算规则同字符串的运算规则
能用于字节串的内建函数
len(x)
max(x)
min(x)
sum(x)
any(x)
all(x)
bytes 和 str 的区别
bytes 用来存储字节(0~255的整数)
str 用来存储unicode字符(0~0x10FFFF的整数)
bytes 与 str 的转换
编码(encode)
str -------------> bytes
b = s.encode(encoding=‘utf-8’)
解码(decode)
bytes -----------> str
s = b.decode(encoding=‘utf-8’)
字节数组 bytearray
可变的字节