LECTURE (1-4)

1.*args

  1. 1.*args reference the argument you pass into the function it could be a single int data or mul-number and etc.
  2. remember use *args but not args when you want use it as a not exactly argument
  3. 2.the star references the every single argument in the tuple so ,you will operate the argument one by one when you try to use the star args rather than using the single args symbol.
  4. 3.
    def type_of_argument(*args):
        print(type(*args))
        print(args)
        print(*args)
    type_of_argument(1,2,3)
    ##expect 
    ##line one :<class 'tuple'>
    ##line two :(1, 2, 3)
    ##line two :1 2 3
  5. 4.look the code above you will have a better understand of the *args(i write the example in python)

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注