How to leading zeros from strings in a list in Python

1 Answer

0 votes
lst = ['00079871', '01900', '00006080', '848470']

lst = [element.lstrip('0') for element in lst]

print (lst)





'''
run:

['79871', '1900', '6080', '848470']

'''

 



answered Feb 2, 2022 by avibootz
...