#!/usr/bin/env python3

import os

print(os.path.exists(r'/usr/bin/'))       #True
print(os.path.exists(r'/usr/bin/env'))    #True

name = r'/usr/bin/env.exe'
print(os.path.dirname(name), os.path.basename(name)) #/usr/bin env.exe

print(os.path.splitext(name))               #('/usr/bin/env', '.exe')
print(os.path.split(name))                  #('/usr/bin', 'env.exe')
print(name.split(os.sep))                   #('/usr/bin', 'env.exe')
print(os.sep.join(name.split(os.sep)))      #/usr/bin/env.exe
print(os.path.join(*name.split(os.sep)))    #usr/bin/env.exe

os.chdir(r'/home')
print(os.getcwd())                  #/home
print(os.path.abspath(''))          #/home
print(os.path.abspath('tom'))       #/home/tom
print(os.path.abspath('.'))         #/home
print(os.path.abspath('..'))        #/
print(os.path.abspath('../etc'))    #/etc

