문자열을 생성하려면 바이트열 객체를 디코딩해야 합니다. 이것은 디코딩하려는 인코딩을 수락할 문자열 클래스의 디코딩 기능을 사용하여 수행할 수 있습니다.
예시
my_str = b"Hello" # b means its a byte string
new_str = my_str.decode('utf-8') # Decode using the utf-8 encoding
print(new_str) 출력
이것은 출력을 줄 것입니다 -
Hello
문자열을 생성하려면 바이트열 객체를 디코딩해야 합니다. 이것은 디코딩하려는 인코딩을 수락할 문자열 클래스의 디코딩 기능을 사용하여 수행할 수 있습니다.
my_str = b"Hello" # b means its a byte string
new_str = my_str.decode('utf-8') # Decode using the utf-8 encoding
print(new_str) 이것은 출력을 줄 것입니다 -
Hello