テストコード:
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)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme