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

Резултати

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

Пребарај: #zerospread

当前筛选 #zerospread清除筛选
SLEX NEWS

@slex_io · Post #74 · 04.08.2023 г., 12:32

🚀 Experience the Freedom of Trading! 📉With SLEX, you can enjoy affordable trading with ZERO spread. Trade your favorite cryptocurrencies as BTC, ETH and XRP without worrying about high fees eating your profits!💱 💰Say goodbye to excessive trading costs and register on SLEX Now and get 20$ welcome bonus till official launch - 17 of August! 💼 #SLEX#Trading#ZeroSpread#CryptoExchange Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter

SLEX NEWS

@slex_io · Post #84 · 02.09.2023 г., 09:32

🚀 SLEX Hits $10M Daily Trading Volumes Just 3 Days In! 🚀 📈Get ready to witness history in the making! Just three days after the official launch of the SLEX exchange, we're thrilled to announce an incredible milestone: our daily trading volumes have soared to an impressive 10 000 000 USDT!📊 ❤️The energy and enthusiasm from traders and investors like you have propelled us to new heights. This phenomenal achievement underscores our platform's immense potential and our community's unwavering support!🌈 🤝We invite you to join SLEX platform, deposit your account, and enjoy zero-spread trading on the spot market! #SLEX#CryptoTrading#zerospread#SLEXtrading Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter