I have data in a text file that is set out like this:
What I want to do is read in line by line. I want to ignore the white space at the beginning of the line (there is some varying amount of white space at the beginning of each line), recognise the white space in between entries, and replace it with a comma and then write that line to a csv file. And then continue line by line until I reach the end of the file, essentially writing the text file to CSV.
e.g.) Output for first 2 lines would be:
But I must do it line by line. The reason being, I will be taking data from other text files which are arranged in the same column like format but putting all of the data side by side in one csv file.
Any tips and suggestions on how I might do this???