you can use libraries os, subprocessandglob
os Library example:
import os
os.system("ls *.txt")
this command returned the whole .txtfile
subprocess Library example:
my_result_command = subprocess.Popen(['ls', '-l'], stdout=log, stderr=log, shell=True)
you can check my_result_command and get the whole file or .txtfile
glob Library example:
import glob
glob.glob('*.txt')
source
share