2018-08-12から1日間の記事一覧

json.dump()

import json from io import StringIO io = StringIO() json.dump(['streaming API'], io)#dump()は書き出す io.getvalue() '["streaming API"]'

rjust(),ljust(),zfill()たち

In [49]: s = 'Hello, world' ...: print (str(s)) ...: print (repr(s))#インタープリタが読めるよう表現を生成する。 ...: print(s.rjust(30))#30文字の中で右寄せる。 ...: print(s.ljust(30))#30文字の中で左寄せる。 ...: print(s.zfill(30))#30文字の…