I am new to Python. I am trying to adjust the format of a list which looks like below:
data=[1,10,313,4000,51234,123456]
and I would like to convert them to a list of strings with leading zeros:
result=['000001','000010','000313','004000','051234','123456']
each of the element has 6 digits.
I know for a single number X, I can do:
str(X).zfill(6)
but I am not sure how to apply this to a list. I would like to solve this problem without using a for loop.
Anyone could help? Thanks.