Created
October 11, 2014 16:34
-
-
Save anonymous/c294596f7a5695c7c84c to your computer and use it in GitHub Desktop.
Parse ' CityCOUNTRY' strings
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
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