Q:

Python List Bracket Removal

So I am trying to add a list of ticker symbols from a CSV file into a python list.
The CSV File looks like this:
AAPL
XOM
EMC

When working with the stockList[].  How do I remove the [' '] brackets and quote marks?
My code is below:
stockList = []
csvReader = csv.reader(open('tickers.csv','rb'), quoting=csv.QUOTE_NONE)
for row in csvReader:
    stockList.append(row)

for item in stockList:
    print repr(item)

For example when the code above is ran it outputs:
['AAPL']
['XOM']
['EMC']

A:

Just use readlines if your data is just a text file with a line-break after each symbol
fh = open('tickers.txt', 'rb')
stockList = [x.rstrip('\n') for x in fh]

That will return you:
['AAPL', 'XOM', 'EMC']

Much easier.

A:

It looks like CSVReader is returning a list of rows. Modify your code in this way.
for row in csvReader:
    row = "".join(row)
    stockList.append(row)

