encode -> create a str
decode -> create a unicode str
In addition, you can't print a unicode string + "\n" together. This will confuse python program and fire an error.
print unicode string
print "\n"
This is ok.
This is because you can't print a unicode directly. To see if a string is a unicode string, print type(test_string). If it is a unicode string, you must print that by using test_string.encode("utf-8")
No comments:
Post a Comment