Python CSV parsing not returning proper rows

前端 未结 3 1470
独厮守ぢ
独厮守ぢ 2021-01-28 01:58

I\'m new to python and having issues with the CSV parser. Here is the code:

import urllib2
import csv


u = urllib2.urlopen(r\'http://finance.yahoo.com/d/quotes.         


        
3条回答
  •  一整个雨季
    2021-01-28 02:23

    csv.reader factory takes as its first argument a list or other iterable iterable of lines, not the full string with line breaks in it (which it will just iterate over by character). Use data = u.readlines() instead of data = u.read().

提交回复
热议问题