Having an issue with reading a csv file that delimits everything with commas, but the first one in the csv file does not contain quotes. Example:
Symbol,"Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary Quote", the code used to try and read this is as follows:
from ystockquote import * import csv with open('companylist.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL) for row in readCSV: print(row[0]) What I get is the following:
Symbol,"Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary Quote",; However, I just want to get all of the symbols from this list. Anyone an idea on how to do this?
edit
More data:
Symbol,"Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary Quote",;
PIH,"1347 Property Insurance Holdings, Inc.","7.505","$45.23M","2014","Finance","Property-Casualty Insurers","http://www.nasdaq.com/symbol/pih",;
FLWS,"1-800 FLOWERS.COM, Inc.","9.59","$623.46M","1999","Consumer Services","Other Specialty Stores","http://www.nasdaq.com/symbol/flws",;
So my expected output would be:
Symbol PIH FLWS This would happen if the csv.reader read my file as each of the rows as a seperate list, and within each of these lists all of the items (delimited by commas) would be their seperate values. (e.g. symbol would be the value of [0], "name" would be the value of [1], etc.)
I hope this clears up what I'm looking for