title: Use variables python script to open file
body: <p>I'm not too familiar with python, can anyone tell me how I can open files using variables in python? 
  I want to automate this in a script to run the same task across multiple directories</p>
  
  <p>Here machine and inputfile are variables..
  I tried the following code but keep getting errors</p>
  
  <pre><code>file = open(machine + '/' + inputfile)
  </code></pre>
  
  <p>printing works fine..
  i.e. the variables were populated correctly:</p>
  
  <pre><code>print 'Input file is "', inputfile -&gt; abc 
  print 'Machine "', machine -&gt; xyz
  </code></pre>
  
  <p>Hence file location should be ./xyz/abc</p>
  
  <p>Error: 
  The error I get is file ./machine/inputfile does not exist, i.e. instead of taking the value of the variable machine and inputfile it is taking them as is.</p>
  
  <p>Apologies if this is too trivial a question</p>