字符编码,字符与字节,文件操作
一,复习 ''' 类型转换 1.数字类型:int() | bool() | float() 2.str与int: int('10') | int('-10') | int('0') | float('-.5') | float('3.14') | str(数字) 3.重点 - str与list: 'abc' => ['a', 'b', 'c']: list('abc') | ''.join(['a', 'b', 'c']) 'abc|def|xyz' => ['abc', 'def', 'xyz']: s.split('|') | '|'.join(ls) 4.list、set、tuple:类型() 5.list与dict: a=1&b=2&c=3 <=> [('a', 1), ('b', 2), ('c', 3)] <=> {'a': 1, 'b': 2, 'c': 3} dic = {} for k, v in [('a', 1), ('b', 2), ('c', 3)]: dic[k] = v ls = [] for k, v in {'a': 1, 'b': 2, 'c': 3}.items(): ls.appen((k, v)) 6.可以通过字典构建任意数据的映射关系: type_map = { 1: '壹',