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

Резултати

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

Пребарај: #stayupdated

当前筛选 #stayupdated清除筛选
MXPlayer Official

@mxofficialchannel · Post #513 · 07.10.2023 г., 15:59

​​Your favourite entertainment platform is now on WhatsApp Channels 🤗 Join now to get all the latest updates about your favorite shows and movies, right in WhatsApp. 🤔 So what are you waiting for? Join MXPlayer's Official WhatsApp Channel today, and get your daily dose of entertainment 🎬🎭 #MXPlayerOnWhatsApp#JoinTheFun#StayUpdated

SingSing Announcement

@singsingchannel · Post #813 · 20.09.2024 г., 09:03

🚨 New Tycoon Game Coming Soon! 🚨 Don't miss out on all the exciting updates! 🎉 Make sure to update your bookmarks with SingSing's latest social channels for valuable info on our upcoming releases: 🔗 Telegram Channel: https://t.me/singsingchannel 🔗 Telegram Chat: https://t.me/singsingglobal 🔗 X (Twitter): https://x.com/singsingglobal 🔗 Website: https://singsing.net/ 🔗 Game Mini App: https://t.me/SingSing_TG_bot Stay tuned, something BIG is coming! 🎮✨ #SingSing#KaraokeTycoon#NFT#GameFi#StayUpdated Announcement | Chat | X (Twitter) | Website | Game

Go! Announcements

@gorwachain_announcements · Post #513 · 29.08.2024 г., 10:54

⚡️Never miss an opportunity to stay ahead of the Curve with Go! 🔗 Official Telegram https://t.me/gorwachain 🔗 Official Discord https://discord.gg/gorwachain Go! Smartchain AI is a hub of innovations and always has juicy opportunities in store for you What better way to harness these opportunities than joining the official platforms👇 Don't enjoy this privilege alone. Share the links to your friends to join in too. The more, the merrier 💥 #gosmartchainAI#Followup#Stayupdated#Discord#telegram Join: 🐣X✉️Chat✉️News🤖Discord Play: 🕹️TON App💻Web App Info: 🖥Newsletter🌐Website🌐Blog