编写python script的时候,经常需要使用def init(self, *args, **kwargs): 其含义代表什么?

  • 这种写法代表这个方法接受任意个数的参数
  • 如果是没有指定key的参数,比如单单‘apple’,‘people’,即为无指定,则会以list的形式放在args变量里面
  • 如果是有指定key的参数,比如item=‘apple’这种形式,即为有指定,则会以dict的形式放在kwargs变量里面
    For example:
    Python爬虫日记-解释def __init__(self, *args, **kwargs)_2020/08/07

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
猜你喜欢
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-10-28
  • 2021-10-11
相关资源
相似解决方案