@talks · Post #42 · 17.08.2016 г., 15:07
#JuliusCaesar
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
Пребарај: #juliuscaesar
@talks · Post #42 · 17.08.2016 г., 15:07
#JuliusCaesar
Hashtags
@googlefactss · Post #40515 · 10.01.2026 г., 02:52
On January 10, 49 BC, Julius Caesar crossed the Rubicon River with his army. This was against the law and started a big war in Rome. Crossing the Rubicon meant he was ready to fight the government and take control. ⚔️🏛️ Extra fact: The phrase "crossing the Rubicon" is an idiom meaning "passing the point of no return" As you probably guessed, it is because of what Julius Caesar did. [Read more 1] [Read more 2] @googlefactss #History#JuliusCaesar#Rubicon#War
@googlefactss · Post #40810 · 16.03.2026 г., 23:01
The Battle of Munda was fought on 17 March 45 BC in southern Hispania. Julius Caesar faced the last Pompeian army led by Gnaeus Pompeius, Sextus Pompeius, and Titus Labienus. The Pompeians held high ground. After hours of heavy fighting, Caesar’s army won. Around 30,000 Pompeians were killed. The victory ended major resistance to Caesar in the Roman civil war. ⚔️🏛️ [Read more] @googlefactss #history#romanempire#ancientrome#juliuscaesar#historyfacts#war