Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Chuyển bytes thành Python String

Decode bytes object bằng .decode(encoding).

Ví dụ

my_str = b"Hello"
new_str = my_str.decode('utf-8')
print(new_str)  # Hello