Created
October 22, 2014 20:21
-
-
Save jackiekazil/4181dee7379b4436afe8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def parse_abbr_from_name(name_abbr): | |
''' Function to parse the abbreviation from the name ''' | |
try: | |
name, abbr = name_abbr.strip(')').split('(') | |
# If there are no '( )', then only one value will return, which | |
# means that there is no abbreviation, there is only a name. | |
except ValueError: | |
name = name_abbr | |
abbr = None | |
return name, abbr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment