Skip to content
Home » AttributeError: ‘list’ object has no attribute ‘encode’

AttributeError: ‘list’ object has no attribute ‘encode’

To solve AttributeError: ‘list’ object has no attribute ‘encode’ error follow below methods.

ERROR LOG

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'encode'

How to solve AttributeError: ‘list’ object has no attribute ‘encode’ ?

Refer the given methods to solve the issue.

Modify your code similar to the code below. You need to unicode each of the list element individually

[x.encode('utf-8') for x in tmp]

Hope the above solution works.

Also read :

ImportError: No module named pythoncom
Typeerror: ‘int’ object is not subscriptable – Python