Possible Duplicate:
RGB Int to RGB - Python
Using Python I need to convert an int to a six digit hex that I can use as a background colour in CSS. Any ideas how to do that?
The int is a primary key of a model in Django.
Convert an int to a 6-digit hex:
In [10]: '{0:06X}'.format(16746513)
Out[10]: 'FF8811'
Check that the hex is equivalent to the int:
In [9]: int('FF8811',16)
Out[9]: 16746513
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With