Posted on 2014-12-18
Total newbie outdoing myself before i've even started to learn python (time is the problem).
I have a text file which contains a list of csv files names. I want python to loop through each row from that text file, open the csv named in the row then pass the contents of the csv to prettytable.
Basically i'm trying to open up multiple csv's in prettytable.
Example of output.txt file contents -
ACCESS SHIPPING LTD.csv
ADANI SHIPPING (INDIA) PVT LTD.csv
ADELFIA SHIPPING ENTERPRISES.csv
AE NOMIKOS SHIPPING INVESTMENTS LTD.csv
AEGEAN SHIPPING MANAGEMENT SA.csv
AL SEER MARINE.csv
ALASSIA NEWSHIPS MANAGEMENT.csv
ALDABRA SOCIETA SAMPLICE.csv
from prettytable import from_csv
cf = open("output.txt", "r")
for rows in cf:
pt = from_csv(rows)
I'e got this far but am getting "AttributeError: 'str' object has no attribute 'read'"