0

How can I expand variable string (substitute, insert, escape) inside another variable? Using variable inside string, then expand string as another variable?

# VARIABLES - to use all of them
i=1
TEST_1 = 10
TEST_2 = 20

# I had tried these syntaxes, but none of the works....:
¨TEST_2 + '_' + TEST_{i}¨.format(**locals())
¨TEST_2 + '_' + TEST_{i}¨.substitute(locals())
...desired (print) output - **20_10**

¨TEST_{i}¨.format(**locals())
...desired (print) output - **10**
John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Scripter
  • 19
  • 4

0 Answers0