下面是我的代码。我无法在我的演示类中调用 google_charts 类的函数。帮我解决问题。
class google_charts:
def all_files_to_one():
pass
prods = []
srcs = []
sname = []
def process_compiled():
global prods, srcs, sname
sname.append('something')
prods.append('something')
srcs.append('something')
def demo():
google_charts.all_files_to_one()
google_charts.process_compiled()
demo()
输出:
Traceback (most recent call last):
File "C:\\demo.py", line 18, in <module>
demo()
File "C:\\demo.py", line 15, in demo
google_charts.all_files_to_one()
TypeError: unbound method all_files_to_one() must be called with google_charts instance as first argument (got nothing instead)