[Tutor] PySide 1.2.2 and Python 3 - "native Qt signal is not callable"
Danny Yoo
dyoo at hashcollision.org
Sun Aug 31 02:43:55 CEST 2014
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.
More information about the Tutor
mailing list