【python】 ゼロパディングする
文字列をゼロパディングする方法を調べた.
文字列メソッドのzfill(桁数)を用いればよい.
>>> num_str = "30" >>> num_str.zfill(4) 0030
【参考】
・http://www.lifewithpython.com/2015/10/python-zero-padding.html
文字列をゼロパディングする方法を調べた.
文字列メソッドのzfill(桁数)を用いればよい.
>>> num_str = "30" >>> num_str.zfill(4) 0030
【参考】
・http://www.lifewithpython.com/2015/10/python-zero-padding.html