python - Appending leading zeroes to a given value -


this question has answer here:

i have various inputs below,i need make given digit 4 letter , append leading zeroes make 4 digit , add "00.00" @ front,can suggest how this?

input:-  val = int(95) val = int(115) val = int(5)   expected output:-  00.00.0095 00.00.0115 00.00.0005 

you this, assuming 00.00 constant.

print(["00.00.{:>04d}".format(v) v in [95, 115, 5]]) # ['00.00.0095', '00.00.0115', '00.00.0005'] 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -