What is the proper way to use str.decode and unicode.encode?
Eg.
print str.decode
print unicode.encode
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ignacio’s example is correct but depends on your console being able to display Unicode characters, which on Windows it usually can’t. Here’s the same thing with only safe string escapes (reprs):
when you’re writing to eg. a file or via a web server, or you’re on another operating system where the console supports UTF-8, it’s a bit easier.