Write Geopy location to CSV file
Question: I'm trying to write the output of this `geopy` object to a `csv` file, but it
puts each letter in a different column and prints the latitude and longitude
on a different line. How can I fix that?

I would like to be able to run this function at different times and print the
new address to the next line. Saving the data not overwriting it. Can this be
done with write `csv` in python?

    
    
    from geopy.geocoders import Nominatim
    import csv
    
    def loc_find(file):
    '''
    This function take in a user given location and gives back the address with 
    city, zip code, state, county and country.
    It also provides latitude and longitude.
    '''
        geolocator = Nominatim()
        loc_input = raw_input("Add the location you would like data back for: ")
        location = geolocator.geocode(loc_input)
        print(location.address)
        print((location.latitude, location.longitude))
    
        with open(r"", 'w') as fp:
            a = csv.writer(fp)
            data = location
            a.writerows(data)    
    


Answer: Well, you are passing a single
[`Location`](https://geopy.readthedocs.org/en/1.10.0/index.html?highlight=location#geopy.location.Location)
object as
[`rows`](https://docs.python.org/2/library/csv.html#csv.csvwriter.writerows)
(a list of row objects), you should pass it as a single row.

Replace:

    
    
    a.writerows(location)
    

With:

    
    
    a.writerow(location) 
    

