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

Резултати

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

Пребарај: #nelsonmandela

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

@rusconct · Post #3202 · 05.12.2025 г., 07:25

✨ Today we remember Nelson Mandela, South Africa’s first democratically elected president and a global symbol of the struggle for freedom, who passed away #OTD at the age of 95. Mandela’s impact reached far beyond South Africa. In Russia, a national day of mourning was declared in his honour. Russian leaders and parliament paid tribute to Madiba, acknowledging the USSR’s long-standing support for the anti-apartheid movement. ✍️ President Vladimir Putin also sent condolences, highlighting the historic ties between the USSR and the ANC during the liberation struggle. A decade later, Mandela’s legacy of justice, dignity, and reconciliation continues to inspire nations across the world. #RussiaSouthAfrica#NelsonMandela

Reuters: World

@reutersworldchannel · Post #149388 · 15.10.2021 г., 01:52

Iconic Nelson Mandela shirts go up for auction The family of former South African President Nelson Mandela is putting up around 100 of his belongings, including some of his iconic shirts, up for auction to help fund a memorial garden in his honor. #NelsonMandela#auction#News#Reuters Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

🕊 The Philosophy of Ubuntu Ubuntu is a core concept in the cultures of southern Africa, including South Africa🇿🇦 Rooted in the Bantu languages, it is often translated as: “I am because we are.” Ubuntu is about humanity, compassion, mutual support, and the ability to forgive🤝 👐Nelson Mandela believed that everyone has the power to change the world — starting with respect for others: 💬 “Ubuntu does not mean that people should not enrich themselves. The question is: are you going to do so in order to enable the community around you to be able to improve?” — Nelson Mandela 🌍 On Mandela Day 🗓 July 18, supporters of the Ubuntu philosophy around the world dedicate 67 minutes to acts of kindness, honoring 67 years of Nelson Mandela’s service to society ❤️ #Ubuntu#NelsonMandela#SouthAfrica#Philosophy#Humanity#MandelaDay

💴South African rands are, arguably, among the most beautiful banknotes and coins in the world 🌍✨ South African banknotes feature the iconic “Big Five” animals 🐘🦁🦏: • R10 — rhinoceros • R20 — elephant • R50 — lion • R100 — buffalo • R200 — leopard The reverse side of each note features Nelson Mandela, honoring his legacy as a symbol of democracy, freedom, and national unity in South Africa ✊🏿🇿🇦 #SouthAfrica#Currency#rands#BigFive#NelsonMandela#Heritage#Culture

🕊Nelson Mandela International Day, or Mandela Day, is celebrated every year on July 18, the birthday of South Africa’s legendary freedom fighter and first Black president. 🇿🇦 🗓 The United Nations officially declared the day in 2009, with the first Mandela Day held on July 18, 2010. #MandelaDay#NelsonMandela#SouthAfrica#UN#HumanRights#Ubuntu#Freedom#Justice#Inspiration#MandelaLegacy