This is a memo for myself. The version is python3.7.1. I will add it as needed.
make_folder.py
# make folder
import os
def make_folder(path):
if os.path.exists(path)==False:
os.mkdir(path)
get_files.py
import os
import sys
def get_images(path):
folder = os.listdir(path):
files = [f for f in folder if os.path.isfile(os.path.join(path, f))]
if len(files)==0:
print("File does not exist")
sys.exit()
return files
get_filename.py
name, ext = os.path.splitext(file)
Recommended Posts