title: How do I parse a file and substitute the environment variables with values in Python
body: <p>I have a text file (lets call it file1.txt), it contains the following lines:
  "read model $path_1"</p>
  
  <p>How do I replace the value of path_1 variable in this text file and write it to another file (lets call it file2.txt) with same contents but $path_1 variable expanded. My file2.txt should contain something like the following:
  "read model /home/Aero/test" </p>
  
  <p>Is there any parser in python available to do this job? I looked into ConfigParser module but looks to me that it needs a config file with variable=value pair.</p>
  
  <p>Regards,
  Sandhya</p>