The hex()
function in python, puts the leading characters 0x
in front of the number. Is there anyway to tell it NOT to put them? So 0xfa230
will be fa230
.
The code is
import fileinput
f = open('hexa', 'w')
for line in fileinput.input(['pattern0.txt']):
f.write(hex(int(line)))
f.write('
')
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…