How to check if a path is absolute path or relative path in cross platform way with Python?
os.path.isabs
returns True
if the path is absolute, False
if not. The documentation says it works in windows (I can confirm it works in Linux personally).
os.path.isabs(my_path)
And if what you really want is the absolute path, don't bother checking to see if it is, just get the abspath
:
import os
print os.path.abspath('.')
Use os.path.isabs
.