如何将要素 类 复制到 ArcGIS/Python 中的新地理数据库中?

How do you copy feature classes into a new geodatabase in ArcGIS/Python?

我正在尝试将文件夹中的要素 类 复制到新的地理数据库中,但是 none 的文件将复制到新的地理数据库中。他们为什么不抄袭?

import arcpy
from arcpy import env
env.workspace="C:\Users\welchk\Desktop\HW6_data\data\"
env.overwriteOutput=True

#creating the gdb
arcpy.CreateFileGDB_management("C:\Users\welchk\Desktop\HW6_data\data\", "t_6.gdb")

#creates a list using ListFeatureClasses function
fclist=arcpy.ListFeatureClasses("*", "polygon")

#uses CopyFeatures_management function to copy feature classes in the list to the data folder. 
for fc in fclist:
#Uses the describe function so below you can tell the basename
    fcdesc=arcpy.Describe(fc)
#copies the features using a function that saves the new feature class with the basename.
arcpy.CopyFeatures_management(fc, "C:\Users\welchk\Desktop\HW6_data\data\t_6.gdb"+fcdesc.basename)
"...t_6.gdb" + fcdesc.basename

您的输出文件路径缺少分隔符。

如果 fcdesc.basename = counties,例如,上面的代码尝试创建 ...t_6.gdbcounties(并且它实际上会生成一个 shapefile)而不是 ...t_6.gdb\counties(一个特征 class 在地理数据库中)。

包括结束分隔符,它按预期运行:

"C:\[directories]\t_6.gdb\" + fcdesc.basename