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

Резултати

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

Пребарај: #letter

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

@PensivePost · Post #4889 · 07.02.2021 г., 23:34

Dear Love, I was passing thru a tunnel, deep, long, dense and drk tunnel full of the pain and agony, freaking and frustrating. It seems there was no end to this tunnel. In despair, i approached you, took your name, imagined your smile! And to my surprise, now the tunnel has ended. A bright beam of the light showing me a path ahead. Love, smiles, happiness all what I wished ahead. It feels like you filled my path with the sun light. Yes jaan, indeed you are the sunshine for me. And Love you love, for being there as bright light for me. Love you love, for bringing lots of happiness for me. Love you love, for gifting me the infinite togetherness. Love you 💕💕💕 #letter #review

Pensive|

@PensivePost · Post #5242 · 30.05.2021 г., 05:06

To the first friend, I made You are the reason to feel and realise what friendship is and how it feels. You brought happiness to my life. You were possessive on me. You were sad when i wasn't talk with you. You motivated me. You stood by my side. You were the one who scold when I do something wrong. I never thought that you left me and found a new best friend(s) But they love you more than me. I wish you to be happy and loved always not to be with me. We still communicate now and then. But not with the same Friendship just like a stranger. You fought with others to sit near with me but now you get over me and sit in other place even when there is no competition. I'm accepted the reality. I appreciate your choice of leaving me and get more loyal, true, lovely friends. I still hope you didn't forget my friendship with you #letter#review#friendshipbreakup