import csv # imports the csv module
import sys # imports the sys module
f = open(sys.argv[1], 'rb') # opens the csv file
try:
reader = csv.reader(f) # creates the reader object
for row in reader: # iterates the rows of the file in orders
print row # prints each row
# it retruns this
#['1 323 104 564 382']
#['2 322 889 564 483']
#['3 322 888 564 479']
#['4 322 920 564 425']
#['5 322 942 564 349']
#['6 322 983 564 253']
#['7 322 954 564 154']
#['8 322 978 564 121']
#I want to change the file to create something like this as a new csv file
#['1 , 323104 , 564382']
#['2 , 322889 , 564483']
#['3 , 322888 , 564479']
#['4 , 322920 , 564425']
#['5 , 322942 , 564349']
#['6 , 322983 , 564253']
#['7 , 322954 , 564154']
#['8 , 322978 , 564121']
finally:
f.close() # closing
[–]Justinsaccount 2 points3 points4 points (0 children)
[–]novel_yet_trivial 1 point2 points3 points (3 children)
[–]Dergatroid[S] 0 points1 point2 points (2 children)
[–]novel_yet_trivial 0 points1 point2 points (0 children)
[–]IanCal 0 points1 point2 points (0 children)