I’m a beginner programmer learning Python.
I have a list:
etfs = ['qqq', 'spy', 'xle', 'xlf', 'xli', 'xlk', 'gld', 'iwm']
which I use to read a MySQL database in a loop.
I have another function where I want to use this list without the single quotations ”.
Is there an easy way for me to strip the ” from each element in this list and create another list from that?
For example
etfs = ['qqq', 'spy', 'xle', 'xlf', 'xli', 'xlk', 'gld', 'iwm']
to
etf_2 = [qqq, spy, xle, xlf, xli, xlk, gld, iwm].
Any help would be greatly appreciated.
I’ve tried using strip, remove, and a wide variety of other methods, but I’m not getting any result.
The only way I’ve managed something similar is using print and sep, but I don’t want to print, I want to create another list.
5