Working along with Module 24 the program executes fine but the resulting file contains no data, anyone any idea why that might be?
Here's the code written using Python v3.5 on Mac
from urllib import request
goog_url = 'http://real-chart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=21&f=2015&g=d&a=2&b=27&c=2014&ignore=.csv'
response = request.urlopen(csv_url)
csv = response.read()
csv_str = str()
lines = csv_str.split("\\n")
dest_url = r'goog.csv'
fx = open(dest_url, "w")
for line in lines:
fx.write(line + "\n")
Module 24 - Blank File
Post a Reply
|Oldest Newest Rating|
· October 22, 2015
Hi, you 've got a typo (spelling-copy-paste mistake).
In that situations when i have alot of lines, and wanna check for a mistake, i help myself by commenting out some lines, and making sure that uncommented code, that i wrote, works as it should. And if it doesnt, i comment more, and if works, i check those commented lines, and so on.
This section is all about snakes! Just kidding.
|Bucky Roberts Administrator|