Skip to content

Remove leading and trailing characters

If you work with data like IDs, you may want to remove leading and/or trailing characters or numbers from a string. Python provides methods for that, called str.strip():

[sc name=”src” url=”https://stackoverflow.com/questions/13142347/how-to-remove-leading-and-trailing-zeros-in-a-string-python” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.