2 回答

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超6個(gè)贊
您可以在 main 函數(shù)中使用 *args 參數(shù)來(lái)傳遞可選參數(shù),例如 df2,如:
def main(df,option=None,type=None, *args):
df2=args[0] # here you will get the df2
# call main function as
main(df,option,type,df2)
或者
您還可以使用kwargs將關(guān)鍵字可選參數(shù)傳遞為,
def main(df,option=None,type=None, **kwargs):
df2=kwargs['df2'] # here you will get the df2
# call main function as
main(df,option,type,df2=df2)
希望這可以幫助!

TA貢獻(xiàn)1909條經(jīng)驗(yàn) 獲得超7個(gè)贊
看起來(lái)你需要。
def main(df,option=None,type=None,df2=None, *args):
if df2 is not None:
#Process df2 ....
添加回答
舉報(bào)