Skip to content

Instantly share code, notes, and snippets.

Created October 11, 2014 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c294596f7a5695c7c84c to your computer and use it in GitHub Desktop.
Save anonymous/c294596f7a5695c7c84c to your computer and use it in GitHub Desktop.
Parse ' CityCOUNTRY' strings
def parse_city_and_country(city_country):
"Parses XxxxXXXX into city and country"
for i in range(len(city_country)):
if city_country[i].isupper() and city_country[i+1].isupper():
city = city_country[:i]
country = city_country[i:]
return [city, country]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment