下記のバイト列をデコードして文字列として整形したいのですがうまくいきません。
in:
b = str(binascii.unhexlify("0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000").decode("utf-8-sig",errors="backslashreplace"))
b
out:
'\x03\x00\x00/*\xe0\x00\x00\x00\x00\x00Cookie: mstshash=Administr\r\n\x01\x00\x08\x00\x03\x00\x00\x00'
具体的には上記のようにデコードした後、下記のように整形しようとしてもできません。
in:
print(b.replace("/*\xe0"," "))
out:
/*\xe0Cookie: mstshash=Administr
わかる方いましたらご回答よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー