Bytes are often thought as sequence of raw bytes. how a sequence of bytes is interpreted is determined by the encode system.
the string.encode method will convert the string to bytes method, and the decode method will convert the bytes object to string object. you may be able to specify different code system.
the following method will be discussed
please find the code below.
''' Created on 2012-10-31 @author: Administrator file: ByteEssentials.py description: ByteEssentials.py demonstrate hte use of encode decode ''' def byte_basics(): unicode_a_with_acute = '\N{LATIN SMALL LETTER A WITH ACUTE}' print(unicode_a_with_acute) xb = unicode_a_with_acute.encode() print(xb) try: xb += 'A' except: print("can't concat bytes to str") pass converted_back = xb.decode() print(converted_back) if __name__ == '__main__': byte_basics()