Python 子函数中怎么使用if
1、这里以sublime text3作为示范,先创建一个py文档。

2、def func1(): passdef func2(): pass这里创建两个函数,因为我们要设定子函数。

4、def func1(): if func2() == "Apple!": return "This is a荏鱿胫协n apple!" else: return "Null"然后我们设定父函数,这里加入if判断,并且要把子函数加入。

6、def func1(): return func2("Apple")def func2(x): if x: retur荏鱿胫协n True else: return Flaseprint(func1())如果要在子函数里面用if,让主函数用到,那么我们要在子函数里面设定参数。
