Ich habe ein Problem. Ich habe mir einen Code geschrieben um Dateien anzupassen.
Der sieht so aus:
Code: Alles auswählen
import csv
output = csv.writer(open('/home/test/output.asc', 'wb'))
with open('/home/test/test.asc', 'rb') as in_data:
for row in data:
value = float(row[2])
if value > 1000000:
row[2] = value - 1000000
row[2] = round(row[2], 2)
output.writerow(row)
Der Code dafür sieht dann so aus:
Code: Alles auswählen
import csv
import pyprind
output = csv.writer(open('/home/test/output.asc', 'wb'))
with open('/home/test/test.asc', 'rb') as in_data:
data = csv.reader(in_data, delimiter =" ")
progress_range = len(in_data.readlines())
progress_bar = pyprind.ProgBar(progress_range)
for i in range(progress_range):
for row in data:
value = float(row[2])
if value > 1000000:
row[2] = value - 1000000
row[2] = round(row[2], 2)
output.writerow(row)
progress_bar.update()
Könnt ihr mir weiterhelfen? Ich finde einfach meinen Fehler nicht.
Vielen Dank schonmal im Vorraus.
Beste Grüße
Simon