python cursor 出错

1 AttributeError: 'builtin_function_or_method' object has no attribute 'execute'

检查 cursor没有获取到应用conn.cursor()

2 使用读取、打开、添加、删除xml文档 保存文档时文档总空

分功能测试代码后发现是 close方法没有写小括号

#write back to the library file
lib=open(r"E:pythonscriptch15library.xml","w")
lib.write(myDoc.toprettyxml(" "))
lib.close()

3 python语句使用的缩进方式不一致时如:一行使用:tab 键、一行使用:空格 ,则提示出错

4 自己编写的程序文件命名与引用的模块或库重名 报错

原文地址:https://www.cnblogs.com/caojuansh/p/11692623.html