I have this txt delimited by whitespaces sinheader.txt . How can I make a script that reads this txt and with it write a csv file.
This is the script Im trying to implement:
import csv
import pandas as pd
prueba = open('station.info').readlines()
open('sinheader.txt', 'w').writelines(prueba[4:-1])
with open('sinheader.txt', 'r') as in_file:
lines = (line.split(" ") for line in in_file)
with open('malobueno.txt', 'w') as out_file:
writer = csv.writer(out_file)
writer.writerows(lines)
This is what Im getting:Bad.txt