💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
>[success] # 函数嵌套回调函数 ~~~ def apply_async(func, args, *, callback): # Compute the result result = func(*args) # Invoke the callback with the result callback(result) ~~~ >[danger] ##### 执行 ~~~ >>> def print_result(result): ... print('Got:', result) ... >>> def add(x, y): ... return x + y ... >>> apply_async(add, (2, 3), callback=print_result) Got: 5 >>> apply_async(add, ('hello', 'world'), callback=print_result) Got: helloworld >>> ~~~