共同点,二者都是表示字符串的一种方式; 在python语法中,可以类似列表的下表进行访问、迭代器迭代,但是都不可以更改。
str -> bytes:
bytes(str_instance, encoding=‘utf-8‘)
str_instance.encode(‘utf-8‘)
bytes -> str:
Python 中str 与 bytes 数据结构转换
原文:https://www.cnblogs.com/operaculus/p/14752727.html