{:2X} didn't output what I expected

jfong at ms4.hinet.net jfong at ms4.hinet.net
Mon Mar 19 19:46:36 EDT 2018


D:\Temp>py
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> '{:02X}'.format(256)
'100'
>>>
What I expected is '00'. Am I wrong?

Best Regards,
Jach Fong



More information about the Python-list mailing list