文字列置換
知らなかった事を恥じたので書く。
a = 'strA' b = 'strB' c = 'strC' text = '1st : %s, 2nd : %s, 3rd : %s' print text % (a, b, c) #=> 1st : strA, 2nd : strB, 3rd : strC tpl = (a, b, c) text = '1st : %s' print text % tpl #=> 1st : strA, 2nd : strB, 3rd : strC text = '1st : %s' print text % (a,) #=> 1st : strA tpl = (a,) text = '1st : %s' print text % tpl #=> 1st : strA text = '1st : %s' print text % a #=> 1st : strA text = '1st : %s' print text % (a) #=> 1st : strA