I have saved a list of ticker symbols into a text file as follows:
MMM ABT ABBV ANF ....
Then I use readlines to put the symbols into a Pyt
You could replace \r\n with the empty string in a replace command.
\r\n
replace
stocks = [x.replace("\r\n","") for x in stocks]