Sometimes the image in one language gets in the way and I can't remember how to write in the other language.
Python
map(lambda n: str(n).rjust(3,"0"), [1,2,3])
>> ["001", "002", "003"]
Ruby
[1,2,3].map{|n| n.to_s.rjust(3,"0")}
>> ["001", "002", "003"]
Recommended Posts