How to turn a range into a two-digit string list in Python

1 Answer

0 votes
lst =  [ '%02d' % i for i in range(15) ]

print(lst)


'''
run:

['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14']

'''

 



answered Jul 11, 2025 by avibootz
...