シングルクォーテーションは文字列のみで展開はされない
text1 = "a" text2 = "文字列#{text1}" print(text2)
出力結果
文字列a
text1 = 'a' text2 = '文字列#{text1}' print(text2)
出力結果
文字列{text1}
rubocopなどでとりあえず""
を使っていると怒られる
シングルクォーテーションは文字列のみで展開はされない
text1 = "a" text2 = "文字列#{text1}" print(text2)
出力結果
文字列a
text1 = 'a' text2 = '文字列#{text1}' print(text2)
出力結果
文字列{text1}
rubocopなどでとりあえず""
を使っていると怒られる