title: Python - Any way to turn relative paths into absolute paths?
body: <pre><code>current_working_directory = os.getcwd()
  relative_directory_of_interest = os.path.join(current_working_directory,"../code/framework/zwave/metadata/")
  
  files = [f for f in os.listdir(relative_directory_of_interest) if os.path.isfile(os.path.join(relative_directory_of_interest,f))]
  
  for f in files:
      print(os.path.join(relative_directory_of_interest,f))
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>/Users/2Gig/Development/feature_dev/scripts/../code/framework/zwave/metadata/bar.xml
  /Users/2Gig/Development/feature_dev/scripts/../code/framework/zwave/metadata/baz.xml
  /Users/2Gig/Development/feature_dev/scripts/../code/framework/zwave/metadata/foo.xml
  </code></pre>
  
  <p>These file paths work fine but part of me would like to see these be absolute paths (without any ../ - I don't know why I care, maybe I'm OCD.  I guess I also find it easier in logging to see absolute paths.  Is there something built into the standard python libraries (I'm on 3.2) that could turn these into absolute paths?  No big deal if not, but a little googling only turned up third-part solutions.</p>
  
  <p>EDIT: Looks like what I want what os.path.abspath(file))  So the modified source could above would now look like (not that I didn't test this, it's just off the cuff):</p>
  
  <pre><code>current_working_directory = os.getcwd()
  relative_directory_of_interest = os.path.join(current_working_directory,"../code/framework/zwave/metadata/")
  
  files = [f for f in os.listdir(relative_directory_of_interest) if os.path.isfile(os.path.join(relative_directory_of_interest,f))]
  
  for f in files:
      print(os.path.abspath(f))
  </code></pre>
  
  <p>Output:</p>
  
  <p>/Users/2Gig/Development/feature_dev/scripts/ZWave_custom_cmd_classes (08262010).xml
  /Users/2Gig/Development/feature_dev/scripts/ZWave_custom_cmd_classes (09262010).xml
  /Users/2Gig/Development/feature_dev/scripts/ZWave_custom_cmd_classes (09262011).xml</p>