SyntaxFix
Write A Post
Hire A Developer
Questions
Using no messy concatenations and padding :
'{:0{width}x}'.format(int(temp,2)), width=4)
Will give a hex representation with padding preserved