1
4

More than 3 years have passed since last update.

【Python】文字列中に変数展開する方法

Last updated at Posted at 2019-11-21

条件

Python3.6以上

サンプルコード

f-stringsを使用する。

first_name = 'Taro'
full_name  = f'Tanaka {first_name}'

print(full_name)
# => 'Tanaka Taro'

参考

 
- Python3.6 から追加された文法機能 - Qiita

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4