I want to use the items in my list to create a new list with the name of the list being item from the first list.
Cs = ['a', 'b', 'c']
List in separate file:
import cs
from os import path
for i in cs.CsNYSE:
destination = 'C:\\Users\\mike\\Desktop\\SMP\\S\\' + i + '.txt'
f = open(destination)
lines = f.readlines()
linNum = len(lines)
X = 1
while X <= linnum:
Name = i
Y = name + []
Y.append(lines[x])
X += 2
I receive a syntax error stating that I cannot append str
with append
. I am pulling names from a very long list, trying to create a list with those names to be run through several algorithms. Can someone point me where I went wrong. Still new to python programming. So, a little explaining would go a long way and be very appreciated. Thanks in advance.