title: How to move to one folder back in python
body: <p>Actually need to go some path and execute some command and below is the code</p>
  
  <p><strong>code</strong>:</p>
  
  <pre><code>import os
  present_working_directory = '/home/Desktop/folder' 
  </code></pre>
  
  <p>presently i am in <code>folder</code></p>
  
  <pre><code>if some_condition == true :
      change_path = "nodes/hellofolder"
      os.chdir(change_path)
      print os.getcwd()
  if another_condition  == true:
      change_another_path = "nodes" 
      os.chdir(change_another_path) 
      print os.getcwd()
  
  **Result**:
  '/home/Desktop/folder/nodes/hellofolder'
  python: [Errno 1] No such file or directory
  </code></pre>
  
  <p>Actually whats happening here is when i first used <code>os.chdir()</code> the directory has changed to</p>
  
  <p><code>'/home/Desktop/folder/nodes/hellofolder'</code>, </p>
  
  <p>but for the second one i need to run a file by moving to one folder back that is </p>
  
  <pre><code>'/home/Desktop/folder/nodes'
  </code></pre>
  
  <p>So can anyone let me how to move one folder back in python </p>