Jul-13-2019, 11:29 PM
If you do only simple variable substitution, you can also do it with
.format(**locals())
, for example>>> a = 4 >>> b = 'foo' >>> c = 'Guido' >>> "The longest {b} has length {a}.".format(**locals()) 'The longest foo has length 4.'