0

I am reading a string from a text file into a Python program. The strings read have variables-names defined in Python code. How can I read the text string from a file and then substitute variables in it with their value?

On Bash I do it using ${variable-name} in text file.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Rais
  • 101
  • 2
  • it depends how you specifed your variables in the file – midori Jan 26 '16 at 15:39
  • it's not a duplicate actually, totally different question, if you don't know bash don't close the question – midori Jan 26 '16 at 15:42
  • It's not a duplicate question. – Rais Jan 26 '16 at 16:34
  • This is a closest question I could find: http://stackoverflow.com/questions/11413950/replacing-variable-names-in-string-with-values-from-list-and-avoiding-redundant – Rais Jan 26 '16 at 18:47

0 Answers0