Python 的 built-in function 中,bytearray()
方法该如何使用呢?需要了解该函数的应用场景,或者说是该在时候使用。
当你要遍历 str
的每一个 byte 的时候就可以用 bytearray
。特别是 python 3 里面 str
,因为始终用 unicode 表示,只有用 bytearray
才能访问到字符串真正的 byte。
Python 的 built-in function 中,bytearray()
方法该如何使用呢?需要了解该函数的应用场景,或者说是该在时候使用。
当你要遍历 str
的每一个 byte 的时候就可以用 bytearray
。特别是 python 3 里面 str
,因为始终用 unicode 表示,只有用 bytearray
才能访问到字符串真正的 byte。