Mega Code Archive

 
Categories / Python / Language Basics
 

Convert a Unicode string into an 8-bit string

#Convert a Unicode string into an 8-bit string using a specific encoding,  #Unicode objects provide an encode() method that takes one argument,  #the name of the encoding. Lowercase names for encodings are preferred. print u"\xc3\xa4".encode('utf-8')