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 слични објави

Пребарај: #rodents

当前筛选 #rodents清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #913 · 15.10.2025 г., 18:11

🌎 Prairie dogs use a complex series of high-pitched calls to warn their colony about predators. These rodents can describe an intruder’s size, color, and speed in their alarm calls. Researchers have identified over 100 different warning sounds in a single colony. ✨ #animalbehavior⚡#communication⚡#rodents 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #619 · 24.08.2025 г., 03:22

🌎 The tuco-tuco, a South American rodent, lives almost its entire life underground. It digs vast tunnel networks with specialized teeth, rarely surfacing except to gather food. Its burrowing helps aerate soil, making tuco-tucos quiet but essential ecosystem engineers. ✨ #rodents⚡#ecosystems⚡#burrowing 👉subscribe Interesting Planet ​

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40226 · 30.11.2025 г., 15:02

🐾 Capybaras are the world's largest rodents — social, semi-aquatic animals that live in groups in South America. They're so calm that other animals often sit on them, and they can even sleep underwater! 🌊 [Learn more] @googlefactss#Capybara#AnimalFacts#Nature#Rodents#Wildlife