import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import arcpy
from arcpy import env
# Allow overwriting of output
#
env.overwriteOutput = 1
# Set current workspace
#
inPath = arcpy.GetParameterAsText(0)
env.workspace = inPath
# Get a list of shapefiles in folder
#
fcs = arcpy.ListFeatureClasses()
# Find the total count of shapefiles in list
#
fcCount = len(fcs)
# Set the progressor
#
arcpy.SetProgressor("step", "Copying shapefiles to geodatabase...", 0,fcCount, 1)
# Create a file gdb to contain new feature classes
#
arcpy.CreateFileGDB_management(env.workspace, "fgdb.gdb")
# For each shapefile, copy to a file geodatabase
#
for shp in fcs:
# Trim the '.shp' extension
# 去除左边的字符
fc = shp.rstrip(".shp")
# Update the progressor label for current shapefile
#
arcpy.SetProgressorLabel("Loading " + shp + "..."
Arcpy 进度条
最新推荐文章于 2024-04-22 18:00:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)