Hi Juan,
Wait, you are working with a CSV file, right? You should not be
trying to parse this by hand if you can avoid it: there's a 'csv'
parser library in the Standard Library.
https://docs.python.org/3.1/library/csv.html
So:
####################################
import codecs
import urllib.request
import csv
urlString = "http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv"
rawFile = urllib.request.urlopen(urlString)
decodedFile = codecs.getreader("utf-8")(rawFile)
rows = csv.reader(decodedFile)
for row in rows:
print(repr(row))
#######################################
should take better advantage of what the Standard Library provides
you: then you just deal with the records. You might have to do a
little to filter out the beginning comment lines, but that shouldn't
be too bad.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor