I've a little problem here. I need to read a txt file and store it into a list, I'm already doing that... but the problem is that I need to manipulate some columns like multiplying then by 30 and so forth so on. (I'm still learning python) (Its python 3.4)
The test.txt file:
Abacate;Para;PA;-1.1166667;-49.65
Abacate;Amazonas;AM;-3.9463889;-62.9038889
The code:
def readFile():
with open('test.txt') as f:
reader = csv.reader(f,delimiter=";")
#reader.next()
for row in reader:
for (i,v) in enumerate(row):
columns[i].append(v)
But, when I try to use
for i in range(0,len(columns[3])):
listTest.append(columns[3][i]*3)
The result is:
['-1.1166667-1.1166667-1.1166667']
['-1.1166667-1.1166667-1.1166667', '-3.9463889-3.9463889-3.9463889']
Expected:
['-3.3500001','-11.8391667']
Is there a better way to do this?