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

Резултати

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

Пребарај: #khiam

当前筛选 #khiam清除筛选
Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #4168 · 16.03.2025 г., 07:57

A steadfast and resilient Iftar last night in my hometown of #Khiam❤️ Iftar took place in the town square surrounded by rubble of their homes and shops brought down by the Zionist war machine with US-made weapons. صحة وهنا ع قلوب أشرف شعوب الأرض❤️

Hashtags

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3935 · 26.01.2025 г., 12:26

تركولي دعسة مسّح صباطي فيها. One of the many letters and messages left behind by Zionist filth in the ruins of my house in the southern Lebanese town of #Khiam..one of which was a good doormat to clean my boots with.

Hashtags

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3586 · 04.11.2024 г., 17:01

In a heartbreaking video, Julia shared moments while she was playing the piano in her home in Khiam, South Lebanon, which she discovered in a video circulated by Israeli soldiers that was destroyed during the border clashes when they were attempting to occupy her town. #SouthLebanon#Khiam#LebanonUnderAttack#Israel

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3747 · 30.11.2024 г., 11:14

After futile attempts, Israeli tanks are invading specific neighborhoods in the border Lebanese villages which their soldiers failed to enter during the battle. With Hezbollah being committed to the ceasefire, who is going to stand up to the endless Israeli aggression? #SouthLebanon#Khiam#Lebanon#Israel#SouthLitani