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

Резултати

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

Пребарај: #phrases

当前筛选 #phrases清除筛选
English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60764 · 08.05.2026 г., 18:02

#phrases 💥Shallow matters ⚜The term "shallow matters" refers to topics, discussions, or concerns that lack depth, seriousness, or significance. They are often superficial and do not engage with deeper issues or complexities. ⚜While many people were debating the impact of climate change, Sarah seemed more interested in the shallow matters of which celebrity was dating whom."

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60754 · 03.05.2026 г., 20:58

#Phrases 💢To cry out for 💠To be in desperate need of something 📝Note:- 📝 the subject is generally not a person, but an organisation, object or situation 🌀 Example:- A:- This room is crying out for some colour and modern furnishing. I suggested subtle green wallpaper, but it didn’t register with Jenny. On second thoughts, maybe red? B:- RED? You've definitely got a screw loose.

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60753 · 03.05.2026 г., 20:58

#Phrases 💢 A chink in one’s armour 💠One small weakness in a person or their argument which makes them open to attack or criticism 🌀 Example:- Our lawyers have been sifting through the evidence but cannot find a chink in the defending company’s armour. It’s no wonder they are being very woolly on how they intend to present our case in court.

Hashtags

ПретходнаСтраница 1 од 4Следна