陪伴本人反复实战的python(2.7和3.9版本均可用)及arcpy包组织编程脚本模板,包含:
1)程序除错调试与异常处理;
2)文件读取与目录组织管理;
3)列表与元组,函数设计。
头部说明及目录组织,logging包的使用,可按需取消注释,第18、19行修改为自己新建的保存信息txt路径:
# -*- coding:utf-8 -*-
# ---------------------------------------------------------------------------
# Author: LGZ
# Created on:
# Reference:
# coding:cp936 or coding:utf-8
# ---------------------------------------------------------------------------
import logging, os, pprint
import pandas as pd
import numpy as np
# import arcpy
# arcpy.env.overwriteOutput = True
# import itertools, random, math
# 修改为自己新建的保存信息txt路径
errfile = r"C:\ArcGISPro\bin\Python\ErrorRecord\ex.txt"
loggingfile = r"C:\ArcGISPro\bin\Python\ErrorRecord\lg.txt"
# logging.disable(logging.CRITICAL) #禁用CRITICAL级别以下的日志记录
# 按此格式显示DEBUG级别以上的日志记录
# logging.basicConfig(filename=loggingfile, level=logging.DEBUG, format="%(asctime)s-%(levelname)s-%(message)s")
logging.basicConfig(level=loggin

最低0.47元/天 解锁文章
1478

被折叠的 条评论
为什么被折叠?



