SyntaxFix
Write A Post
Hire A Developer
Questions
You need to do encode on tmp[0], not on tmp.
encode
tmp[0]
tmp
tmp is not a string. It contains a (Unicode) string.
Try running type(tmp) and print dir(tmp) to see it for yourself.
type(tmp)
print dir(tmp)