title: Create file path from variables
body: <p>I am looking for some advice as to the best way to generate a file path using variables, currently my code looks similar to the following:</p>
  
  <pre><code>path = /my/root/directory
  for x in list_of_vars:
          if os.path.isdir(path + '/' + x):  # line A
              print(x + ' exists.')
          else:
              os.mkdir(path + '/' + x)       # line B
              print(x + ' created.')
  </code></pre>
  
  <p>For lines A and B as shown above, is there a better way to create a file path as this will become longer the deeper I delve into the directory tree?</p>
  
  <p>I envisage an existing built-in method to be used as follows:</p>
  
  <pre><code>create_path(path, 'in', 'here')
  </code></pre>
  
  <p>producing a path of the form <code>/my/root/directory/in/here</code></p>
  
  <p>If there is no built in function I will just write myself one.</p>
  
  <p>Thank you for any input.</p>