티스토리 뷰

Python

Multiple Argument

techbard 2016. 4. 28. 18:08

# Multiple Argument


def main():

myFunc(1, 2, 3, 4, 5)


# multiple argument

def myFunc(one, two, *args):

print("the values are {} {} {}".format(one, two, args))


ourFunc(1, 2, 3, 4, 5, 6, onee = "Monday", twoo = "Tuesday")


#Key Word Arguments

def ourFunc(a, b, c, *args, **kwargs):

print("hello", kwargs['onee'], kwargs['twoo'])


if __name__ == "__main__": main()


# 결과

the values are 1 2 (3, 4, 5)

hello Monday Tuesday


댓글
댓글쓰기 폼
공지사항
Total
411,812
Today
1
Yesterday
14
«   2020/01   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
글 보관함