如何跳过在Python方法中提供默认参数的方法

如何跳过在Python方法中提供默认参数的方法,第1张

如何跳过在Python方法中提供默认参数的方法

有两种方法可以做到这一点。首先,最直接的方法是传递一个命名参数:

boto.emr.step.StreamingStep(name='a name', mapper='mapper name', combiner='combiner name')

(请注意,因为

name
mapper
是按顺序排列的,所以不需要指定参数名称)


另外,您可以传递带有

**

参数unpacking的字典:

kwargs = {'name': 'a name', 'mapper': 'mapper name', 'combiner': 'combiner name'}boto.emr.step.StreamingStep(**kwargs)


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5667166.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存