1import os
2def fn(): # 1.Get file names from directory
3 file_list=os.listdir(r"C:\Users")
4 print (file_list)
5
6 #2.To rename files
7fn()
1#get all .txt files in my_path
2import glob
3my_path='/home/folder/'
4files=glob.glob(my_path+'*.txt')
1def file_read(fname):
2 with open(fname) as f:
3 #Content_list is the list that contains the read lines.
4 content_list = f.readlines()
5 print(content_list)
6
7file_read(\'test.txt\')
8
9