0
0

More than 3 years have passed since last update.

位置引数のタプル化

Posted at
def say_something(word, word2, word3):
    print(word)
    print(word2)
    print(word3)

say_something('Hi!', 'Mike', 'Nance')



def say_something(*args):
    print(args)
say_something('Hi!', 'Mike', 'Nance')

def say_something(*args):
    for arg in args:
        print(arg)
say_something('Hi!', 'Mike', 'Nance')

def say_something(word, *args):
    print('word=', word)
    for arg in args:
        print(arg)
say_something('Hi!', 'Mike', 'Nance')

Hi!
Mike
Nance
('Hi!', 'Mike', 'Nance')
Hi!
Mike
Nance
word= Hi!
Mike
Nance
word= Hi!
Mike
Nacy

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0