python - Extending string formatting with custom conversion types -


string.formatter allows extension of new style formatting custom conversion types.

is possible older "%"-style formatting strings too? there library this?

maybe

class customformat(object):     def __init__(self, obj):         self.object = obj      def __str__(self):         return str(self.object).upper()  # magic goes here...  print "abc%s" % customformat("hello") # abchello