python 编码
字符编码 中文: >>> name = '你好' >>> name '\xe4\xbd\xa0\xe5\xa5\xbd' 英文: >>> name = "hiekay" >>> name 'hiekay' 计算机中的字符编码 一般用utf-8 UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或只须做少部份修改,即可继续使用。因此,它逐渐成为电子邮件、网页及其他存储或发送文字的应用中,优先采用的编码。 encode和decode 从encode()和decode()两个内置函数: codecs.encode(obj[, encoding[, errors]]):Encodes obj using the codec registered for encoding. codecs.decode(obj...