<div class="container">
<div class="button">
Button
</div>
<div class="menu_gap">
<div class="menu">
Menu
</div>
</div>
</div>
.container {
position: relative;
width: 200px;
height: 50px;
background: #f00;
}
.button {
display: block;
color: #fff;
}
.menu_gap {
position: absolute;
top: 100%;
left: -20px;
padding: 0 20px 20px 20px;
display: none;
}
.container:hover .menu_gap {
display: block;
}
.menu {
background: #000;
color: #fff;
width: 400px;
padding: 10px 0;
}
>>> text = 'eujiyghkiuyhjiu'
>>> from collections import Counter
>>> Counter(text)
Counter({'u': 3, 'i': 3, 'h': 2, 'j': 2, 'y': 2, 'e': 1, 'k': 1, 'g': 1})
try:
pass
except Exception as e:
print(e)
m = re.search('<br/>(.*)<br/>', text)
if m:
print(m.group(1))
setxkbmap -option 'caps:escape,caps:shift_nocancel' -layout us
Ctrl key position
┌───────────────────────────────────────────────────────────────────────────────────┐
│Option Description │
├───────────────────────────────────────────────────────────────────────────────────┤
│ctrl:nocaps Caps Lock as Ctrl │
│ctrl:lctrl_meta Left Ctrl as Meta │
│ctrl:swapcaps Swap Ctrl and Caps Lock │
│ctrl:ac_ctrl At left of 'A' │
│ctrl:aa_ctrl At bottom left │
│ctrl:rctrl_ralt Right Ctrl as Right Alt │
│ctrl:menu_rctrl Menu as Right Ctrl │
│ctrl:ctrl_ralt Right Alt as Right Ctrl │
│ctrl:swap_lalt_lctl Swap Left Alt key with Left Ctrl key │
│ctrl:swap_lwin_lctl Swap Left Win key with Left Ctrl key │
│ctrl:swap_rwin_rctl Swap Right Win key with Right Ctrl key │
│ctrl:swap_lalt_lctl_lwin Left Alt as Ctrl, Left Ctrl as Win, Left Win as Alt │
│ │
└───────────────────────────────────────────────────────────────────────────────────┘
In [1]: ', '.join(['my', 'super', 'list'])
Out[1]: 'my, super, list'
In [2]: import os
In [3]: os.path.join('path', 'to', 'script')
Out[3]: 'path/to/script'
In [4]: os.path.abspath(os.path.join('path', 'to', 'script'))
Out[4]: '/home/username/path/to/script'
In [5]: os.path.abspath(os.path.join('/', 'path', 'to', 'script'))
Out[5]: '/path/to/script'
суть шаблона Декоратор
>>> def f(d):
... for i in set(d):
... e = d[i]
... if isinstance(e, dict):
... f(e)
... elif e == 0:
... del d[i]
...
>>> d = {'user1': {'var1': 2,
... 'var2': 0,
... 'var3': 1,
... 'var4': 0},
... 'user2': {'var1': 0,
... 'var2': 1,
... 'var3': 0,
... 'var4': 0},
... 'user3': {'var1': 1,
... 'var2': 0,
... 'var3': 0,
... 'var4': 0}}
>>>
>>> f(d)
>>> d
{'user3': {'var1': 1}, 'user2': {'var2': 1}, 'user1': {'var1': 2, 'var3': 1}}
>>>