In [ ]:
import os
os.path.join('/usr','local/bin','python')
In [ ]:
os.path.split('/usr/local/bin/python')
In [ ]:
import glob
dir(glob)
In [ ]:
help(glob)
In [ ]:
f= glob.glob('/tmp/*')
In [ ]:
dir(os.path)
In [ ]:
f=glob.glob('/tmp/*')
for i in f:
print "{file} is dir? {isdir}".format(file=i,isdir=os.path.isdir(i))
In [ ]:
help(os.path.walk)
In [ ]:
import subprocess
help(subprocess)
In [ ]:
try:
print subprocess.check_output(["ls", "-l", "XXXXX"])
except subprocess.CalledProcessError as e:
print "{}: {}".format(repr(e),e)
In [ ]:
import shutil
dir(shutil)
In [ ]:
shutil.get_archive_formats()
In [ ]:
help(shutil.rmtree)
In [ ]:
help(os.makedirs)
In [ ]:
os.makedirs('/tmp/pyconestest/sub/subsub',mode=0755)
In [ ]:
glob.glob('/tmp/pyconestest')
In [ ]:
shutil.rmtree('/tmp/pyconestest')
In [ ]:
os.path.exists('/tmp/pyconestest')
In [ ]:
import tempfile
tempfile.__all__
In [ ]:
mydir = tempfile.mkdtemp(prefix='pycones2015', dir=None)
print mydir
In [ ]:
print os.path.exists(mydir)
os.rmdir(mydir)
print os.path.exists(mydir)
In [ ]:
help(tempfile.mktemp)
In [ ]:
tempfile.gettempdir()