Python

Python OS.PATH

모의해커 2015. 8. 16. 16:20

import os,sys

=======================
sys.modules.keys()
=> print all of using module
=========================
os.getcwd()
=> show current working directory
=========================
os.path.isdir(r'filelocation/filename') or os.path.isfile(r'filelocation')
=> True/False
=========================
os.path.exists(r'filelocation')
=> is filelocation exists
=========================
os.path.getsize(r'filelocation')
=> show filesize
=========================
os.path.split(r'filelocation/filename')
=> show "filelocation","filename"
=========================
os.path.splitext(filelocation/filename)
=> 'filename', '.txt .exe .hwp ...'
=========================
os.chdir(r'fileloation')
=> current directory location change
=========================