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

Резултати

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

Пребарај: #sawt

当前筛选 #sawt清除筛选
Addis Standard

@addisstandardeng · Post #21214 · 27.01.2026 г., 15:45

News: Salsay Weyane raises concerns over election conditions as #NEBE presses Interim Administration on preparations Salsay Weyane #Tigray (#SAWT) has raised concerns over the feasibility of holding elections in Tigray under current conditions, warning that key prerequisites for a credible electoral process remain unmet, even as the National Election Board of Ethiopia (NEBE) continues to push ahead with preparations for the seventh national general election scheduled for June 2026. In a press release issued on yesterday, the party said the security situation in Tigray remains unconducive to free and fair elections, citing the absence of a fully functional civil administration capable of facilitating the electoral process. SAWT also said that significant parts of the region remain under the control of what it described as illegal authorities, while millions of people displaced from .... https://www.facebook.com/AddisstandardEng/posts/pfbid0U3XZe5RbDTaESQgC3BfL9rEh5cyi9XiSpXRVcUfgyJ9oH2rmcZ5vCMDXfDixjTCCl