replaced single quote char by single quote
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def log(value):
|
||||
|
||||
try:
|
||||
print(str(datetime.now()) + ' ' + value.encode("utf-8"))
|
||||
except UnicodeEncodeError:
|
||||
print(str(datetime.now()) + ' print error')
|
||||
print(str(datetime.now()) + ' ' + value)
|
||||
# try:
|
||||
# print(str(datetime.now()) + ' ' + value.encode("utf-8"))
|
||||
# except:
|
||||
# print(str(datetime.now()) + ' print error')
|
||||
|
||||
#print(u' '.join(( str(datetime.now()), value)).encode('utf-8').strip())
|
||||
@@ -40,6 +40,9 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
|
||||
|
||||
geonames = getLocationArray(countrycode)
|
||||
|
||||
city = re.sub(u"(\u2018|\u2019)", "'", city) #replaces single quotes chars by '
|
||||
|
||||
|
||||
# log('cityname and city: ' + cityname + " , " + city)
|
||||
|
||||
#first tries name with 'gemeente as prefix'
|
||||
@@ -65,7 +68,6 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
|
||||
if (geo): return geo;
|
||||
|
||||
#removes everything between () and then removes the leading and trailing spaces;
|
||||
|
||||
log('name before regex ' + city)
|
||||
#city = re.sub('/\([^()]*\)/g', '', city)
|
||||
city = re.sub("[\(].*?[\)]", "", city)
|
||||
@@ -77,7 +79,6 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
|
||||
#print('without anything between ()' + repr( geo))
|
||||
if (geo): return geo;
|
||||
|
||||
|
||||
#also tries in the alternatenames
|
||||
geo = list(filter(lambda g: inAlternatenames(g.alternatenames, city), geonames))
|
||||
if(geo): geo = geo[0]
|
||||
|
||||
Reference in New Issue
Block a user