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

Пребарај: #guri

当前筛选 #guri清除筛选
Pensive|

@PensivePost · Post #5437 · 28.09.2021 г., 11:18

Efforts to get separate from each other or Their thoughts, bring them more and more closer than before ??? ???? Their Story definitely will not end in the mid! May be today they are not as they should be.. Umm..later on they'll be! I'm sure abt it.. Yess..They're Blessed! !!!! 🥀 -Gurpreet Bhatia #guri#review#poetry

Pensive|

@PensivePost · Post #5405 · 20.09.2021 г., 19:12

She's a mother, a daughter, She's brave, courageous, Is She's feeble ? Helpless ? No! It's you, your frame of mind, Still let's her freedom to rescind! She's not disabled, Just the scenario made her existence confined, Even in the century of 21st, She's still defenseless over the set of your mind! She never got the freedom, which a boy gets at his age, So could you please let me know, How She's guilty at every stage ? Either She's LAXMI to NIRBHAYA and PRIYANAKA in 2019, Nothing has changed, Every single day, every single minute, nd in every single second, She's molested, burnt and raped! This act is plaintive enough, We can't even think of, Only a question I wanted to ask, When she'll get rid of! 💯 -Gurpreet Bhatia #guri#poetry#review#write