I need to convert a list of ticker symbols: T GOOG KO PEP as examples in a a text file to a python list: ['T','GOOG','KO',PEP']. However, the current code I'm using keeps adding a space after each symbol yielding: ['T ','GOOG ','KO ',PEP '] instead. How can I get the tickers without spaces?
stocks = open('C:\Model\Stocks\official.txt', 'r').read()
print stocks.split('\n')