with os python get list files code example
Example 1: list files python
#get all .txt files in my_path
import glob
my_path='/home/folder/'
files=glob.glob(my_path+'*.txt')
Example 2: get list of files in directory python
import os
path = '/folder1/folder2/'
files = os.listdir(path)