Here is my script:
# I have 100 variables
x0 = 3.14
x1 = 2.72
x2 = 1.41
x3 = 2.33
.... (omit this part)
x100 = 7.77
# xi corresponds to the value that the index i of a list needs to subtract, 
# now I want to loop through the list
for i in range(100):
    lst[i] -= 'x{}'.format(i)
This clearly won't work, since the variable is not a string. So how should I string formatting a variable?



forif it helps you avoid having 100 variables? This looks like an XY problem, you're asking something to get around a problem, but the real issue is different - and we don't know all of the context to be able to effectively help you.