Reputation: 13
How to convert hexadecimal value 0x000F
into string value "0F"
in python? Basically, I've been trying to convert number to string.
Upvotes: 0
Views: 194
Reputation: 781731
Use %
formatting:
str = "%02x" % 0x000F
%x
formatting means to format as a float, the 02
prefix means to put it in a 2-digit field with zero padding.
Upvotes: 3