(Apr-21-2019, 12:36 PM)Chinmay Wrote: This was fixed my issue
Tried using front slash / in string literal in save_path.
According to OP input, there are some blank rows, so took care of that with len(row)>0 condition.
I think you can just rename text files in mac OS and turn txt files to csv. Or use Microsoft Excel to do that also.
But...
Where I work we would use this method:
import os import pandas as pd save_path = "C:\Users\desktop\Python-testing\" in_filename = os.path.join(save_path,'Input.txt') out_filename = os.path.join(save_path,'Output.csv') df = pd.read_csv(in_filename, sep=";") df.to_csv(out_filename, index=False)