replaced single quote char by single quote

This commit is contained in:
Computerboer
2024-07-13 23:42:00 +02:00
parent fd4cbc1ac8
commit 2da852c974
2 changed files with 8 additions and 7 deletions

View File

@@ -1,10 +1,10 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
def log(value): def log(value):
print(str(datetime.now()) + ' ' + value)
try: # try:
print(str(datetime.now()) + ' ' + value.encode("utf-8")) # print(str(datetime.now()) + ' ' + value.encode("utf-8"))
except UnicodeEncodeError: # except:
print(str(datetime.now()) + ' print error') # print(str(datetime.now()) + ' print error')
#print(u' '.join(( str(datetime.now()), value)).encode('utf-8').strip()) #print(u' '.join(( str(datetime.now()), value)).encode('utf-8').strip())

View File

@@ -40,6 +40,9 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
geonames = getLocationArray(countrycode) geonames = getLocationArray(countrycode)
city = re.sub(u"(\u2018|\u2019)", "'", city) #replaces single quotes chars by '
# log('cityname and city: ' + cityname + " , " + city) # log('cityname and city: ' + cityname + " , " + city)
#first tries name with 'gemeente as prefix' #first tries name with 'gemeente as prefix'
@@ -65,7 +68,6 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
if (geo): return geo; if (geo): return geo;
#removes everything between () and then removes the leading and trailing spaces; #removes everything between () and then removes the leading and trailing spaces;
log('name before regex ' + city) log('name before regex ' + city)
#city = re.sub('/\([^()]*\)/g', '', city) #city = re.sub('/\([^()]*\)/g', '', city)
city = re.sub("[\(].*?[\)]", "", city) city = re.sub("[\(].*?[\)]", "", city)
@@ -77,7 +79,6 @@ def getGeoLocationByCity(city = "", countrycode: Countrycode = Countrycode.NL ):
#print('without anything between ()' + repr( geo)) #print('without anything between ()' + repr( geo))
if (geo): return geo; if (geo): return geo;
#also tries in the alternatenames #also tries in the alternatenames
geo = list(filter(lambda g: inAlternatenames(g.alternatenames, city), geonames)) geo = list(filter(lambda g: inAlternatenames(g.alternatenames, city), geonames))
if(geo): geo = geo[0] if(geo): geo = geo[0]