os

Create path if not exists

import os
if not os.path.exists(path):
   os.mkdir(path)

filename = os.path.basename(path)
f, ext = os.path.splitext(filename)

os.environ.get(“key”, “default”)

Get files list

from glob import glob
files = glob(“*.csv”)

Split filename

# filename = "hello.txt"
# path = "/home/myname/hello.txt"
# f = "hello"
# ext = "txt"

filename = os.path.basename(path)
f, ext = os.path.splitext(filename)

Remove

Last updated