For example, I define a function like this to process several text files
def file_process(file):
procedures
...
return (a,b,c)
If I have 5 text files, how can I let all of them get through this function, and the output result is assign to each file's outcome.
The objective is like:
x1, y1, z1 = file_process(a.txt)
x2, y2, z2 = file_process(b.txt)
x3, y3, z3 = file_process(c.txt)
x4, y4, z4 = file_process(d.txt)
x5, y5, z5 = file_process(e.txt)
but of course this kind of typing is stupid. So if I try for
loop:
for f in [a.txt, b.txt, c.txt, d.txt, e.txt]:
x,y,z = file_process(f)
then how to ensure the result separately assigned to every text file's outcome?