-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathex25.py
More file actions
33 lines (24 loc) · 724 Bytes
/
ex25.py
File metadata and controls
33 lines (24 loc) · 724 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
#!/home/wizard/anaconda3/bin/python
# 1. декларация
def show(title,*args,kw1='a',kw2='b',**kwargs):
print(f'Positional: title={title}')
if args:
print('List of args:')
for v in args:
print(f'arg:{v}')
print(f'Keyword only:kw1={kw1},kw2={kw2}')
if kwargs:
print('Keyword params:')
k_params = {
'ip': kwargs.get('ip','127.0.0.1')
, 'path': kwargs.get('path','/tmp')
}
print(f'k params:{k_params}')
if __name__ == '__main__':
# 2. извикване
config = {
'ip':'192.168.1.1'
, 'path':'/usr/local'
}
show('Text Editor',kw2='Python', **config)
show('Text Editor', path='/home')