Created
October 29, 2018 12:25
-
-
Save abs51295/48e3c44473455c25875720fa53d502b6 to your computer and use it in GitHub Desktop.
canonicalize name
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 | |
_canonicalize_regex = re.compile(r"[-_.]+") | |
def canonicalize_name(name): | |
# This is taken from PEP 503. | |
return _canonicalize_regex.sub("-", name).lower() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment