How to save a cvs file to a certain folder on computer?

I don’t understand the dest_url=r’goog.csv’ part of the program. I think it is used to save the file we get from the Internet to the computer, but how does the computer understand that it has to save the file, when there is no save function to sth like that. It is as if we just have a dest_url and assign it a string value.

from urllib import request

goog_url = ''

def download_stock_data(csv_url):
    response = request.urlopen(csv_url)
    csv =
    csv_str = str(csv)
    lines = csv_str.split("n")
    dest_url = r'goog.csv'
    fx = open(dest_url, "w")
    for line in lines:
        fx.write(line + "n")


Source: python

Leave a Reply