arcgis python 表属性转html
发布时间:2020-12-20 10:54:21 所属栏目:Python 来源:网络整理
导读:import arcpy import sys import string import ostablePath = arcpy.GetParameterAsText(0)filePath = arcpy.GetParameterAsText(1 )outfile = open(filePath, " w " )fields = arcpy.ListFields(tablePath)fieldNames = [] for field in fields: if (field
import arcpy import sys import string import os tablePath = arcpy.GetParameterAsText(0) filePath = arcpy.GetParameterAsText(1) outfile = open(filePath,"w") fields = arcpy.ListFields(tablePath) fieldNames = [] for field in fields: if (field.type <> "Geometry" and field.type <> "BLOB"): fieldNames.append(field.name) outfile.write("<table border=""1"">n") outfile.write("<tr>n") for fieldName in fieldNames: outfile.write("<th>" + fieldName + "</th>n") outfile.write("</tr>n") for row in arcpy.da.SearchCursor(tablePath,fieldNames): outfile.write("<tr>n") for value in row: outfile.write(u"<td>" + str(value) + "</td>n") outfile.write("</tr>n") outfile.write("</table>n") outfile.flush() outfile.close() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |