import csv
import sys
f = open(sys.argv[1], 'rb')
reader = csv.reader(f)
k = []
for i in reader:
j = i.replace(' ','')
k.append(j)
print k
the raw CSV is 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 make it look like this:
['1323104564382']
['2322889564483']
['3322888564479']
['4322920564425']
['5322942564349']
['6322983564253']
['7322954564154']
['8322978564121']
i get the following error:
Traceback (most recent call last): File "list_replace.py", line 12, in j = i.replace(' ','') AttributeError: 'list' object has no attribute 'replace'
Im super new at this so im probably screwing multiple things up,just need some guidance.
I eventually want the csv to look like the below text, but im taking it one step at a time
['1,323104,564382']
['2,322889,564483']
['3,322888,564479']
['4,322920,564425']
['5,322942,564349']
['6,322983,564253']
['7,322954,564154']
['8,322978,564121']