Python glob.glob函数未执行

2024-10-03 06:27:13 发布

您现在位置:Python中文网/ 问答频道 /正文

有人能告诉我为什么glob.glob语句没有执行吗

我写了一个很好,但另一个不起作用。你能看出我做错了什么吗

我正在使用pycharm

这个有效

TC = glob.glob("L:/Support/Data_load/Tenements/%s/NSW/FME*/GSNSWDataset/TitlesCurrent.shp" % (d))[0]

x = arcpy.AddField_management(TC, "Date_Ext", "DATE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

这个没有。我现在已经按照建议在末尾添加了[0],但现在我只得到了这个错误,而不是“IndexError:列表索引超出范围”

Moo = glob.glob(r"L:\Support\Data_load\Tenements\{}\SA\Mineral tenements - exploration\Exploration Licence Applications-Mineral and_or Opal_*\Exploration Licence Applications-Mineral and_or Opal.gdb\Mineral_and_or_Opal_Exploration_Licence_Applications")[0]

# Process: Add Field
X = arcpy.AddField_management(Moo,'Test2',"TEXT","","",100)

Tags: orandsupportdataloadlicenceglobopal