def function1(): a=1 return adef function2(): b=a+1 print(b)这种情况会显示a是undefined。不考虑变量重名的情况,怎么才能让function2能用上function1里面的那个a?
答:函数一里面返回了变量a,那么你要使用它的话,只需要调用这个函数。 具体使用方法如下。