Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 232012

How to get absolute path in Python?


To return the absolute path when you provide shortcut path such as ".", e.g.

import os
print os.path.abspath(".") # print the full path of ., depending where you execute the program

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>