I want to:
Import CSV formatted data into a python list/array
Right justify a 8 space field for the string
Write the output as a text file
For example, I want to turn csv data such as:
11111, 22,
333, 4444
Into:
11111 22
333 4444
My code currently looks like:
import csv
input_file = "csv_file.csv"
my_data = csv.reader(open(input_file, "rb"), delimiter=',')
for i,j in my_data:
x = ('%-15s %s\n' % (i,j))
with open('my_output.txt', 'w') as file:
file.writelines(x)
Thank you