我有一个gdb,其中包含一个从Frequency工具生成的表,我想将表添加到脚本中。如何使用搜索光标访问表格?
这是剧本:
print "START"
print""
arcpy.env.overwriteOutput = 1
fc = "D:\AVI \zl\zevel.gdb\point"
list_Fields = arcpy.ListFields(fc)
my_list = ("a","b","c")
for name in list_Fields:
if name.name in my_list:
print name.name
output = r"D:\AVI \zl\zevel.gdb"
tbl_name = output + r"\tbl"+"_"+ name.name
print tbl_name
arcpy.Frequency_analysis(fc,tbl_name,name.name)
### arcpy.SearchCursor....
答案 0 :(得分:1)
我通常使用with语句调用游标,所以我不小心忘记关闭它们并导致数据锁定。
<?php
///////// Database Details , add here ////
$dbhost_name = "localhost";
$database = "test"; // Your database name
$username = "root"; // Login user id
$password = "test"; // Login password
/////////// End of Database Details //////
//////// Do not Edit below /////////
try {
$dbo = new PDO('mysql:host=localhost;dbname='.$database, $username, $password);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
可替换地:
with arcpy.da.SearcCursor(fc, list_fields) as sr_cursor:
for row in sr_cursor:
# some code
希望这会有所帮助。有关更多信息,请查看arcgis资源页面: http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000