Professional Documents
Culture Documents
파이썬 - args, kwargs
파이썬 - args, kwargs
JH PROJECT
python
*args, **kwargs .
" "
.
purepleya
*args
- . args .
)
1 def print_param(*args): ?
2 print args
3 for p in args:
4 print p
5 (148)
6 print_param('a', 'b', 'c', 'd')
7 #('a', 'b', 'c', 'd') JH PROJECT (2)
8 #a IT (146)
9 #b
10 #c
11 #d
2014/11 (1)
1 def print_param4(a, b, c): ? 2014/09 (1)
2 print a, b, c 2014/03 (1)
3
4 p = ['a', 'b', 'c'] 2014/02 (20)
5 print_param4(*p) 2014/01 (11)
6 #a b c
7
8 p2 = {'c' : '1', 'a' : '2', 'b' : '3'}
9 print_param4(**p2)
10 #2 3 1 2017/03
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
Posted by purepleya
, .
: : : :
purepleya's Blog is powered by Daum / Designed by Tistory