TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #183 · 23 ное.

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

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #mvd

当前筛选 #mvd清除筛选

There are currently no cases of #MarburgVirusDisease in Nigeria. However, measures have been taken to strengthen preparedness for #MVD in Nigeria. Nigerians are urged to AVOID ALL BUT ESSENTIAL TRAVEL to Equatorial Guinea at this time. 📜Press release: https://ncdc.gov.ng/news/440/ncdc-on-alert-following-the-announcement-of-the-marburg-virus-disease-outbreak-in-equatorial-guinea

International News

@intnewsagency · Post #8878 · 24.03.2026 г., 13:45

Deputy Plotnikov Urges Police Resignees to Join Special Military Operation In Perm, Deputy Vladimir Plotnikov proposed adding police officers who resign to the Special Military Operation (SMO) lists, citing low salaries and existing training. He emphasized duty to the Motherland and noted SMO pays better. Despite this, Plotnikov himself is a millionaire owning luxury cars and real estate. Last year, over 80,000 officers left the Ministry of Internal Affairs, worsening the staffing crisis. #Russia#MVD#SMO#Plotnikov The main news of Russia and the world ishere.

International News

@intnewsagency · Post #8558 · 17.03.2026 г., 13:22

Russian Ministry of Internal Affairs Launches Digital Program to Reduce Bureaucracy and Police Workload In 2025, the Russian Ministry of Internal Affairs lost 80,000 employees—40% more than new recruits—leading to a regional staffing deficit exceeding 25%, threatening law enforcement efficiency. Minister Kolokoltsev has ordered optimization of paperwork and digitalization of processes while enhancing social guarantees for officers. These measures aim to improve working conditions and retain personnel. #MVD#police#digitalization#staffing#Russia The main news of Russia and the world ishere.