変数にprint(f)するには。
>>> tmp = "%d" % 100
>>> print tmp
100
>>>
tmp = "%.3f" % (100.0 / 3.0)
>>> print tmp
33.333
フォーマット文の後に%、そして数字
標準出力へのprintf(的)なのは
>>>print "the number is %d" % 100
the number is 100
>>>
変数にprint(f)するには。
>>> tmp = "%d" % 100
>>> print tmp
100
>>>
tmp = "%.3f" % (100.0 / 3.0)
>>> print tmp
33.333
フォーマット文の後に%、そして数字
標準出力へのprintf(的)なのは
>>>print "the number is %d" % 100
the number is 100
>>>
コメントを残す