Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Limit the maximum splits while parsing ADM2 codes

It seems there's an ADM2 code which includes dots,
which is also the separator for all the codes
defining the ADM2 (country code.ADM1 code.ADM2 code).
By limiting the number of splits, we can parse it
without problems.
  • Loading branch information...
commit 921059becf9d1d7fd07c074673f7de1d7c529362 1 parent a41753d
Alberto García Hierro authored November 26, 2008

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  geonames-import
2  geonames-import
@@ -231,7 +231,7 @@ class GeonamesImporter(object):
231 231
         line = fd.readline()[:-1]
232 232
         while line:
233 233
             codes, name, ascii_name, geoname_id = line.split('\t')
234  
-            country_id, adm1, code = codes.split('.')
  234
+            country_id, adm1, code = codes.split('.', 2)
235 235
             try:
236 236
                 admin1 = self.admin1_codes[country_id][adm1]
237 237
             except KeyError:

0 notes on commit 921059b

Please sign in to comment.
Something went wrong with that request. Please try again.