import pandas as pd def calculate(file_path): f = open(file_path,"r") lines = f.readlines() f.close() ll = [line.strip().split(",") for line in lines] res = [] for l in ll: res.append([i.strip() for i in l]) if len(l) != 11: print(len(l)) ll = [l[0].strip() for l in ll] #ll = list(set(ll)) #print(ll[:3]) #print(len(ll)) #columns = [i for i in range(len(l[0]))] #df = pd.DataFrame(data=res, columns=columns) #df.to_excel("89.xlsx", index=False) calculate("2023-02-20.txt")