Created
February 5, 2015 19:32
-
-
Save blackrobot/ea5dca3f62483245a454 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# This removes any leading digits, or whitespace | |
foo = re.compile(r'^[\d\s]+') | |
foo.sub('', "0123345 Hello World") # 'Hello World' | |
# This removes zeros only | |
bar = re.compile(r'^[0]+') | |
bar.sub('', "012345 Hello World") # '12345 Hello World' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment