0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【個人的備忘録】pythonの*argsの使い方 まとめ

Posted at
テストコード:

def Test(*args):   #*argsを引数に指定
    for i in arg:  #for文でiに代入
        print(i)   #printで出力
Test("come", "here", "cororonn!") #実行結果

# ↓実行結果↓
"""
come
here
cororonn!
"""

また次のようにもできる
def Test_second(word, *args):
    print("word =", word)
    for i in args:
        print(i)
# Test_second("TEST", "language")

t = ("TEST", "RESET")
Test_second("TEST", *t) 






0
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?