[lang-ref] 文字列中の変数補完 ( python )

def test_string_interpolation_variable():
    # f'{x}'
    name = 'John'
    s = f'My name is {name}.'
    assert s == 'My name is John.'
def test_string_interpolation_variable_alternative():
    # '%s'
    name = 'John'
    s = 'My name is %s.' % name
    assert s == 'My name is John.'