Am .01.2016, 14:12 Uhr, schrieb Thomas Nygårds <
thomas...@gmail.com>:
> Thanks! Nice format string, and probably faster! Did not know about it.
Well, I had to look it up myself but your code looked so bad I knew
something else would be possible! ;-) It will be significantly faster,
though I can't imagine you'd notice in any openpyxl code.
hex() always returns a string. Redundant casting to strings should be
avoided, not least for the chance that unicode issues might crop up in
Python 2 code.
FWIW: well worth reading
https://docs.python.org/3/library/string.html#formatstrings
Some of the tricks inherited from printf style are non-obvious {:02X} #
":" announces additional instructions; "X" says uppercase hex; "02" says 2
chars wide, pad with 0 if necessary. I wonder if there's a site where you
can test this stuff out like you can with regexes?