【发布时间】:2021-04-10 09:57:01
【问题描述】:
我有以下代码,
def hello(start, end):
perform some function
for i in range(j):
yield (some value)
yield (some value)
def calc(start, end):
start = "x"
end = "y"
for d in hello(start, end):
perform some function
data = 123
perform some function
data1 = 456
return data, data1
def world(hello()):
with open(r"C:\filepath\abc.json",'w') as file:
json.dump(hello.data, file)
with open(r"C:\filepath\abc.json") as file1:
d = json.load(file1)
return d
- 现在,我想使用 hello() 函数的返回值(data & data1) 在 world() 函数中,也想使用 world() 的返回值 另一个函数中的函数。
- 此外,world() 函数将作为模块导入,并且应该 在另一个模块的函数中使用。
我该怎么做?
【问题讨论】:
标签: python-3.x function return python-module