出力フォーマット

投稿者: | 9月 2, 2022

format( ) メソッド

>>> name1 = 'Tom'
>>> name2 = 'Kent'
>>> 'Next fight match is {} vs {}.'.format(name1, name2)
'Next fight match is Tom vs Kent.'

f-string( ) メソッド

>>> f'Next fight is {name1:4} vs {name2:4}.'
'Next fight is Tom  vs Kent.'