add folder to python path code example
Example 1: save pythonpath
export PYTHONPATH="${PYTHONPATH}:/my/other/path"
Example 2: how to add directory to python script
import os
basepath = 'my_directory/'
with os.scandir(basepath) as entries:
for entry in entries:
if entry.is_file():
print(entry.name)
Example 3: how to add directory to python script
from pathlib import Path
basepath = Path('my_directory/')
files_in_basepath = basepath.iterdir()
for item in files_in_basepath:
if item.is_file():
print(item.name)