-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunc.py
More file actions
49 lines (27 loc) · 662 Bytes
/
Copy pathfunc.py
File metadata and controls
49 lines (27 loc) · 662 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File : func.py
# @Author: ly
# @Date : 2018/11/10
# 关键字参数
def print_(name, age):
print('name is %s age is %s' % (name, age))
print_(age=13, name='js')
print(123)
# 默认参数
def print_default(name=1, *age):
print(type(age)) # tuple
print('name is %s age is %s' % (name, age)) # (10, 11, 12)
def print_dict(name=1, **age):
print(name, age)
print_default(9, 10, 11, 12)
print_dict(a=1, b=2)
def cal_(a, *, c):
print(a, c)
cal_(1, c=3)
size = 20
def con_():
age = 1
return lambda a, b: a + b + age + size
res = con_()(1, 2)
print(res) # output 24