While using the format function, it seems that there was a problem that I did not know the concepts of global and regional variables. You set global variables such as a0, b0, which are data frames with 10 rows by truncating data frames.
In the last iteration, I want to put a0, a1, b0, etc. in each data frame This is a situation where only the a0 string appears. In the last iteration, how to set the global variable, or to get to the answer I want I'd really appreciate it if you could suggest a way.
python loops
a0, a1, ... Write a[0], a[1], and a[2] instead.
I don't know why it's so hard to write index numbers in variable names.
Oh? This works
print('<act type="h" x="{}" y="{}" end_time = "" />'.format(globals()['a{}'.format(i)],globals()['b{}'.format(j)]))
In this case, please use it as a list so that it can be as mentioned above.
Thank you.
© 2025 OneMinuteCode. All rights reserved.