In [1]:
import os

In [8]:
os


Out[8]:
<module 'os' from '/Users/seongjoo/anaconda/lib/python2.7/os.pyc'>

In [4]:
os.path


Out[4]:
<module 'posixpath' from '/Users/seongjoo/anaconda/lib/python2.7/posixpath.pyc'>

In [5]:
os.path.exists


Out[5]:
<function genericpath.exists>

In [6]:
os.path.exists('no_such_file')


Out[6]:
False

In [7]:
os.path.exists('hello_world.txt')


Out[7]:
True

In [10]:
# 절대경로
os.path.abspath('hello_world.txt')


Out[10]:
'/Users/seongjoo/Documents/development/python/python_tutorial/hello_world.txt'

In [11]:
# 경로 합치기
os.path.join('users', 'seongjoo', 'python')


Out[11]:
'users/seongjoo/python'

In [17]:
filepath = 'some_other_folder/some_file.txt'
os.path.split(filepath)


Out[17]:
('some_other_folder', 'some_file.txt')

In [ ]: