I have multiple text files in a folder where data is the form of- text file 1 and text file 2
I want to extract the file name and IOS value from text file 1 and file name and MB/s value from text file 2 and store it in excel file
here's my code-
import os
path = "Folder Path"
os.chdir(path)
def read_text_file(file_path):
with open(file_path, 'r') as f:
print(f.read())
for file in os.listdir():
if file.endswith(".txt"):
file_path = f"{path}\{file}"
read_text_file(file_path)
with open ('text file 1.txt') as f:
for line in f:
read = line.spilt(" ")
print (IOS)
with open ('text file 2.txt') as f:
for line in f:
read = line.spilt(" ")
print (BW)MB/s
How do I solve this ?