【发布时间】:2018-03-20 18:21:16
【问题描述】:
我有一个 unicode 对象列表,想将它们编码为 utf-8,但编码似乎不起作用。
代码在这里:
>>> tmp = [u' test context']
>>> tmp.encode('utf-8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'encode'
>>>
我不明白为什么没有属性编码
【问题讨论】: