String formatting for hex colors in Python,print('{0:06x}'.format(123))