If you will test all subjects during one run of the experiment, then you could use a subject loop. Otherwise you will need to keep some ‘state’ of used subject numbers. This means a file with ‘used numbers’ or what I do is something like:
type or paste code here
```## get unique data outfile name and log some stuff
while ( os.access(the_ofilename, os.F_OK) ):
print("using " + the_ofilename )
outfile = open(the_ofilename,'a+');
outfile.write(datetime.now().ctime()+' '+ str(the_ofilename) + '\n')
to check for existing used numbers and go 1 number higher. However, if you delete a file, ( e.g., you have tested subject 00 through 10, put you delete 08 because it was a dud), 08 will get reused.