Im new to Python, and Im learning it fro the new boston's guide on youtube.
im having trouble downloading csv files through python.
this is the code -
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/untitled/New_Boston_ep_24.py", line 1, in <module>
from urllib.request import urlopen
ImportError: No module named request
PS im new to forums, so let me know if i made any mistake in posting. Help is appreciated
im having trouble downloading csv files through python.
this is the code -
from urllib import request
goog_url = 'http://www.google.com/finance/historical?q=NASDAQ:GOOG&output=csv'
def download_stock_data(csv_url):
response = request.urlopen(csv_url)
csv = response.read()
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")
fx.close()
download_stock_data(goog_url)The error im receiving is-Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/untitled/New_Boston_ep_24.py", line 1, in <module>
from urllib.request import urlopen
ImportError: No module named request
PS im new to forums, so let me know if i made any mistake in posting. Help is appreciated
