-1

我是编程新手,无法运行此代码,它经常显示错误,例如模块对象不可调用。谁能帮我解决这个问题?

import simplekml
kml = simplekml.kml() #what's wrong here?
kml.newpoit(name="sample",coords[(11,12)])
kml.save("H:\\python\\point.kml")`

Traceback (most recent call last):
  File "H:/programs/practice.py", line 2, in <module>
    kml = simplekml.kml()
TypeError: 'module' object is not callable
4

2 回答 2

1

I guess you meant to call simplekml.Kml() (with capital K) to create an instance of this class. So probably it was just misspelling.
simplekml is a module, which you import in the very first line of your code.
I advise you to have a look at simplekml.Kml class documentation.

于 2019-06-22T13:20:02.853 回答
0

simplekml.kml是内部的一个模块simplekml,因此不可调用,如错误消息所述。您可能打算调用simplekml.Kml()(使用大写字母 K)来创建一个Kml实例。

于 2019-06-22T13:10:09.720 回答