rook rook - 1 year ago 89
Python Question

Fixing '../../' paths in python

Is there an easy way in Python to resolve path operators like

? For instance is there a function call that will convert:

Answer Source

You can use os.path.realpath() to get the canonical path. To get a normalised relative path, use os.path.normpath().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download