[python] string 与 byters之间的互转

    # string to byters
    a_byters = bytes(a_str,'utf-8')
    a_byters = a_str.encode('utf-8')

    # byters to string
    a_str = a_byters.decode('utf-8')
    a_str = str(a_byters,encoding='utf-8')

你可能感兴趣的:([python] string 与 byters之间的互转)