Python files

From Augix' Wiki

Jump to: navigation, search
  • to get the full pathname to a script that python is executing
import os, sys
os.path.abspath(sys.argv[0])
  • list all the files in given folder
import glob
glob.glob(”/mypath/*.txt)
  • create a folder if it does not exist
import os
if not os.path.exists(dir):
  os.mkdir(dir)
Personal tools