I'm currently writing a forloop that will run a function iteratively chaning a certain parameter each time based on a tuple, then save the output. I'd like the file name for the output to match the variable that was run for that iteration. Here is my code and error:
#define tuple
range_length = (50, 75)
for i in range_length:
evs.set_module('A2_ra_Ind_krig_3d', 'Krig Settings', 'Range': i})
evs.set_module('A2_ra_Ind_krig_3d', 'Properties', 'Execute', True)
#Where error is
file_string = '\\\\C:\\A2_Radium_Range_{0:.0f}'.format(range_length)
evs.set_module('write evs field', 'Properties', 'Filename', file_string)
Error when ran:
TypeError: unsupported format string passed to tuple.__format__
Note, I simplified some of the code to focus on the error, which is related to the file string. Everything works up until that point. Any help with this would be much appreciated, Thanks
CodePudding user response:
What you want to pass is actually the variable i
instead of range_length
. Therefore, the line should be
file_string = '\\\\C:\\A2_Radium_Range_{0:.0f}'.format(i)