python string formatting: truncation
Learned a new trick in python today, truncating strings in format specs using .precision.
>>>"%.2s" % "abcdef"
'ab'
Using this while yak-shaving, improving my Python logging formatting by truncating the log level name from a string like WARNING to a single character W
%(levelname).1s %(module)s:%(lineno)-4d %(message)s
W process_one:40 Nothing processed
I process_one:103 Wrote to state: /tmp/testOA-tJZweo/us-ca-oakland/index.json