This is probably quite a simple problem, but can't seem to figure it out or find any answered questions with regards to this issue.
xcombined=[]
for i in range (1,20):
from 'files_'+str(i) import x
for j in range(0,len(x)):
xcombined.append(x[j])
results in the following error:
import "files_"+str(i)
^
SyntaxError: invalid syntax
I am wishing to import a list, (ie x=[15.34, ..., 15.54]) from files_1.py, files_2.py, etc and append it to another list called xcombined so that xcombined is sum of all of the "x's" from all the "files_*.py's". If I am correct 'files_'+str(i) cannot work as it isn't a string? Is there a quick way around this problem?
Thanks in advance. Paul