how do i list a type of file in a directory python code example
Example 1: list files in directory python
import os
print(os.listdir('/path/to/folder/to/list'))
Example 2: python file list
def file_read(fname):
with open(fname) as f:
#Content_list is the list that contains the read lines.
content_list = f.readlines()
print(content_list)
file_read(\'test.txt\')