I have a list of unicode objects and want to encode them to utf-8, but encoding doesn't seem to work.
the code is here :
>>> 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'
>>>
I can't understand why there is no attribute encode
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…