G05
This commit is contained in:
parent
f4afb37947
commit
ee7d0e9e08
File diff suppressed because one or more lines are too long
17
TaskG05/run.py
Normal file
17
TaskG05/run.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import sys
|
||||||
|
import binascii
|
||||||
|
|
||||||
|
def hex_to_utf8(hex_string):
|
||||||
|
hex_string = hex_string.replace(' ', '').replace('0x', '')
|
||||||
|
bytes_data = binascii.unhexlify(hex_string)
|
||||||
|
|
||||||
|
try:
|
||||||
|
utf8_text = bytes_data.decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
utf8_text = bytes_data.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
return utf8_text
|
||||||
|
|
||||||
|
for line in sys.stdin:
|
||||||
|
result_text = hex_to_utf8(line.strip())
|
||||||
|
print(result_text.encode('utf-8'))
|
Loading…
Reference in New Issue
Block a user