I am creating a large set of math tests with question that have random numbers generated and I want to be able to save multiple copies, push them to latex and get them saved all within one python code. I understand the python os.system command and the subprocess.run command can do this, but I am not able to figure out how to get the file into the command because it iterates. I currently am trying to use a string to accomplish this task.
for i in range(1, 11):
f = open("test_" + str(i).zfill(2) + ".tex", 'w+')
##### run test building code here ######
f.close()
#subprocess.run("pdflatex f.name") #<--- How do I get this to run for each of the 10 files
I can run this with the actual file name, so I know it's not hard, but I can't seem to figure out how to pass in the string file name.