@LeagueOfLegendsLatamSur · Post #2619 · 25.02.2021 г., 19:54
#Sad
Hashtags
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
Пребарај: #sad
@LeagueOfLegendsLatamSur · Post #2619 · 25.02.2021 г., 19:54
#Sad
Hashtags
@ukraine_war_truth · Post #44 · 24.11.2024 г., 02:20
Ukraine has 2-7 trillion dollars of minerals that the US wants to get its hands on. Remember how at the beginning of the war Western propaganda claimed this was some righteous fight for democracy, lol? Light VS dark struggle? Well, no one is even pretending anymore - its all about the Benjamins. And if Western politicians and American and global corporations that have made hundreds of billion off of this suffering always knew that, it might be a surprise to some good-hearted people in the West who believed those lies. Show this clip to them, please. I also found a version with Ukrainian subtitles. If you have any friends from there, forward it to them too, please. So that they know what almost a million of their sons, fathers and husbands have died for - so that America can exploit their country for generations to come... #sad. Very, very sad, as the future president likes to say... Please subscribe to our channel - help share the Ukraine War Truth! Peace!
Hashtags
@Lash_gif · Post #40908 · 15.08.2023 г., 19:23
#girl | #sad clb: #other
@Lash_gif · Post #35410 · 09.01.2023 г., 16:18
#girl | #sad Clb: #other
@Lash_gif · Post #34813 · 26.11.2022 г., 07:54
#girl | #sad Clb: #other
@Lash_gif · Post #34722 · 19.11.2022 г., 07:35
#girl | #sad Clb: #other
@Lash_gif · Post #43260 · 16.01.2024 г., 02:59
#boy | #sad Clb: #other
@Lash_gif · Post #41283 · 31.08.2023 г., 17:44
#boy | #sad Clb: #other
@Lash_gif · Post #41126 · 22.08.2023 г., 11:49
#boy | #sad Clb: #other
@Lash_gif · Post #39644 · 30.06.2023 г., 08:32
#boy | #sad Clb: #other
@Lash_gif · Post #39577 · 27.06.2023 г., 07:06
#boy | #sad Clb: #other
@Lash_gif · Post #39486 · 23.06.2023 г., 06:52
#boy | #sad Clb: #other