stringtobyte1 파이썬 문자열 처리 #String을 bytes로 변환 myStr = "Hello" str_utf = myStr.encode('utf-8') str_utf2 = bytes(myStr, 'utf-8') #bytes를 String으로 변환 myBytes = b'Hello' myStr = myBytes.decode('utf-8') myStr2 = str(myBytes, 'utf-8') import binascii #bytes를 16진수 형태로 출력 Bytes = b"Hello" Bytes_hex = Bytes.hex() 또는 Bytes_hex = binascii.hexlify(bytes).decode('utf-8') print(Bytes_hex) 문자열을 16진수로 변환 import binascii #String을 Bytes로 변.. 2022. 4. 7. 이전 1 다음