Hello list!!
I'm trying to write a CSV file to work it with Excel. My python script is
working, the issue is: when I import the file from excel the data comes with
quotes at the beginnig and ending of the row. I don't want to have these
quotes. What is wrong with my code?
import os, csv
from osgeo import ogr,gdal,osr
from dbf import *
gdal.AllRegister()
file_list = []
folders = None
for root, folders, files in os.walk( "C:\\" ):
file_list.extend(os.path.join(root,fi) for fi in files if
fi.endswith(".shp"))
writer = csv.writer(open('csv2.csv', "wb"))
campos = ['Ruta,Archivo,.prj']
writer.writerow(campos)
for row, filepath in enumerate(file_list, start=1):
(ruta, filename) = os.path.split(filepath)
n = os.path.splitext(filepath)
p = n[0]+'.prj'
if os.path.exists(p):
aRow = [""+filepath+","+filename+",1"]
writer.writerow(aRow)
else:
aRow1 = [""+filepath+","+filename+",0"]
writer.writerow(aRow1)
print "El archivo esta listo"
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor