![](/img/trans.png)
[英]How to skip the Pylint message for function definition in Python?
[英]How to skip the parameters of a function in python?
我在调用 function 时试图跳过参数。你能帮我怎么做吗?
例子:
我必须在下面调用 function,它有 3 个参数:
send_mail(audit_df, LOG_FILE, Duration)
我必须调用上面的 function 来跳过第一个和第三个参数。 我怎样才能做到这一点?
您可以为参数设置默认值。 我不知道什么对你有用,所以我只是将它们设置为None
。
def send_mail(audit_df=None, log_file=None, duration=None):
do all the things
打电话的时候
send_mail(log_file="myfile")
如需简单阅读,请参阅文档的Function 定义部分。
您可以放置“无”来代替参数。
这将使 python 假设它是 Nothing 并且什么都不做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.