How to use hex() without 0x in Python?

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('\n')
    >>> format(3735928559, 'x')
    'deadbeef'

From: stackoverflow.com/q/16414559