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

Резултати

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

Пребарај: #russiankremlin

当前筛选 #russiankremlin清除筛选
Russian Consulate in Cape Town

@rusconct · Post #1969 · 07.11.2024 г., 21:18

📺 Vladimir Putin addressed the plenary session of the 21st annual meeting of the Valdai International Discussion Club 🌍We are destined to live in an era of fundamental, even revolutionary changes, and not only to comprehend but also to take a direct part in the most complex processes of the first quarter of the 21st century. We are witnessing the formation of a completely new world order, nothing like we had in the past. 💪🏻New powers are rising. Nations are becoming more and more aware of their interests, their value, uniqueness and identity, and are increasingly insistent on pursuing the goals of development and justice. 📌Societies are confronted with a multitude of new challenges, from exciting technological changes to catastrophic natural disasters, from outrageous social division to massive migration waves and acute economic crises. ⚠️Experts talk about the threat of new regional conflicts, global epidemics, about complex and controversial ethical aspects of interaction between humans and artificial intelligence, about how traditions and progress reconcile with each other. ❌Western liberalism has expressed itself in extreme intolerance and aggression towards any alternative, towards any sovereign and independent thought, and today supports neo-Nazism, terrorism, racism and even mass genocide of civilians. 💣International conflicts may result in mutual destruction. Weapons capable of doing this exist and are constantly being improved as technology develops. And the number of owners of such weapons is expanding, and no one guarantees that in case of final destruction of legal and moral norms it will not be involved. ❌The West's calls to inflict a strategic defeat on Russia, the country with the largest arsenal of nuclear weapons, demonstrate the extreme adventurism of Western politicians. Such a blind belief can turn into a world tragedy. We have come to a dangerous line. 🇷🇺Unlike our opponents, Russia does not perceive Western civilization as an enemy, does not ask the question "us or them". 🙌🏻 Common efforts could be directed with much greater benefit, a return on solving truly common problems that affect everyone: from the problems of demography and social inequality to climate change, food security, medicine and new technologies. Full version: Valdai Discussion Club meeting #RussianKremlin#RussianMFA#VladimirPutin