How to use hex() without 0x in Python?
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
The code is
import fileinput f = open('hexa', 'w') for line in fileinput.input(['pattern0.txt']): f.write(hex(int(line))) f.write('\n')
>>> format(3735928559, 'x') 'deadbeef'
★ Back to homepage or read more recommendations: