I have the following piece of code:
# -*- coding: utf-8 -*-
import csv, geocoder
def extract_address(lat="", lng=""):
    if lat and lng:
        g = geocoder.google([lat, lng], method='reverse')
        if g:
            if g.street is not None:
                postal = g.postal
                housenumber = g.housenumber
                if g.housenumber is None:
                    housenumber = ""
                if g.postal is None:
                    postal = ""
                address = str(g.street.encode("utf-8")) + ", " + str(housenumber.encode("utf-8")) + ", " + str(postal.encode("utf-8")) + " " + str(g.city.encode("utf-8")) + ", " + str(g.country_long.encode("utf-8"))
                print type(address)
                return address.decode('utf-8')
with open('my_prueba.csv', 'w') as t:
    spamwriter = csv.writer(t, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator='\n')
    spamwriter.writerow(['st_y', 'st_x', 'Address'])
    address = extract_address('some_lat', 'some_lng'))
    print address
    spamwriter.writerow([str(lat), str(lng), str(address.encode('utf-8'))])
this is the output:
<type 'str'>
Calle Hernán Cortés, 16, 28004 Madrid, Spain
but what I get once I open the csv file is this:
I've been trying many things, and reading different related stackoverflow posts, but nothing...can anyone give me a hand with this?!
Thanks in advance!
EDIT: I want to then convert it to a Excel file. If I open the csv with another app, the columns are separated in another way I don't want. My code above gives me the right separation when I open the csv file with excel

 
    
