2 ms·
Format string is very inconvenient approach because you need to duplicate type information. >>> '%i' % 's' Traceback (most recent call last): File "<stdin>",
by bvrmn 7y ago
Format string is very inconvenient approach because you need to duplicate type information.
>>> '%i' % 's'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %i format: a number is required, not str
>>> '{}'.format('s')
's'
>>> '{}'.format(10)
'10'