Python + bash
Если вам часто требуется запускать shell команды из Python-кода, какой способ вы используете?
Самый низкоуровневый это функция os.system(), либо os.popen(). Рекомендованный способ это subprocess.call(). Но это всё еще достаточно неудобно.
Советую обратить своё внимание на очень крутую библиотеку sh.
Что она умеет?
🔸 удобный синтаксис вызова команд как функций
# os
import os
os.system("tar cvf demo.tar ~/")
# subprocess
import subprocess
subprocess.call(['tar', 'cvf', 'demo.tar', '~/'])
# sh
import sh
sh.tar('cvf', 'demo.tar', "~/")
🔸 простое создание функции-алиаса для длинной команды
fn = sh.lsof.bake('-i', '-P', '-n')
output = sh.grep(fn(), 'LISTEN')
в этом примере также задействован пайпинг
🔸 удобный вызов команд от sudo
with sh.contrib.sudo:
print(ls("/root"))
Такой запрос спросит пароль. Чтобы это работало нужно соответствующим способом настроить юзера.
А вот вариант с вводом пароля через код.
password = "secret"
sudo = sh.sudo.bake("-S", _in=password+"\n")
print(sudo.ls("/root"))
Это не все фишки. Больше интересных примеров смотрите в документации.
Специально для Windows💀 юзеров
#libs#linux
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 165 622.4 as of 18.11.2022.
The aggregate volume of state owned share in 225 JSCs totaled UZS 133 689.2 billion, i.e. 80.7 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 165 616.4 as of 11.11.2022.
The aggregate volume of state owned share in 225 JSCs totaled UZS 133 690.1 billion, i.e. 80.7 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 630 and the aggregate volume of shares issues totaled UZS 165 616.2 as of 04.11.2022.
The aggregate volume of state owned share in 225 JSCs totaled UZS 133 690.3 billion, i.e. 80.7 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 165 616.2 as of 28.10.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 133 687.6 billion, i.e. 80.7 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 164 689.5 as of 21.10.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 133 687.6 billion, i.e. 81.2 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 164 619.5 as of 14.10.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 133 677.9 billion, i.e. 81.2 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 164 609.8 as of 07.10.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 133 677.9 billion, i.e. 81.2 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 164 597.6 as of 30.09.2022.
The aggregate volume of state owned share in 225 JSCs totaled UZS 133 665.7 billion, i.e. 81.2 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 164 397.9 as of 23.09.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 133 348.9 billion, i.e. 81.1 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 163 200.5 as of 16.09.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 132 889.5 billion, i.e. 81.4 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 631 and the aggregate volume of shares issues totaled UZS 163 200.4 as of 09.09.2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 132 895.8 billion, i.e. 81.4 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube
DEPO - #STATISTICS
CHANGES IN STRUCTURE OF SHAREHOLDERS
The number of JSCs totaled 630 and the aggregate volume of shares issues totaled UZS 163 190.4 as of 26 August 2022.
The aggregate volume of state owned share in 226 JSCs totaled UZS 132 895.8 billion, i.e. 81.4 %.
#structure#shareholders#share#infographics#statistics#changes
deponet.uz|Tg|Fb|Inst|Youtube