string — Common string operations — Python 3.9.5 documentation

PHOTO EMBED

Mon Jun 14 2021 22:24:45 GMT+0000 (Coordinated Universal Time)

Saved by @miltar #python #string #format

>>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', longitude='-115.81W')
'Coordinates: 37.24N, -115.81W'
>>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}
>>> 'Coordinates: {latitude}, {longitude}'.format(**coord)
'Coordinates: 37.24N, -115.81W'
content_copyCOPY

String format

https://docs.python.org/3/library/string.html