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

Резултати

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

Пребарај: #globaluncertainty

当前筛选 #globaluncertainty清除筛选
Crypto M - Crypto News

@CryptoM · Post #64527 · 09.04.2026 г., 06:14

🚀 Japan Considers Additional Oil Reserve Release Amid Strait of Hormuz Uncertainty Japan is contemplating the release of an additional 20 days' worth of oil reserves as early as May. According to NS3.AI, this decision comes amid ongoing uncertainties surrounding the reopening of the Strait of Hormuz. Japan's heavy reliance on the Middle East for approximately 95% of its oil supply underscores the significance of this move. Since March 16, Japan has already released around 50 days of reserves and still maintains a reserve sufficient for 230 days. #Japan#oilreserves#StraitofHormuz#oilsupply#MiddleEast#energymarket#globaluncertainty

Crypto M - Crypto News

@CryptoM · Post #64775 · 09.04.2026 г., 22:03

🚀 PRECIOUS METALS | Spot Gold and Silver Open Slightly Higher, WTI Crude Oil Rises Spot gold and silver prices opened slightly higher on Friday, alongside an increase in WTI crude oil prices. According to Jin10, the futures for the three major U.S. stock indices showed a slight decline. This movement in the commodities market comes amid ongoing global economic uncertainties, influencing investor sentiment and market dynamics. The fluctuations in precious metals and crude oil prices are closely watched by traders and analysts, as they reflect broader trends in the financial markets. #preciousmetals#gold#silver#WTI#crudeoil#economy#commodities#globaluncertainty#financialmarkets#trading#investors

Crypto M - Crypto News

@CryptoM · Post #65042 · 10.04.2026 г., 15:27

🚀 Hermès Expands Leather-Goods Production Amid Global Uncertainty Hermès has inaugurated its 25th leather-goods manufacturing facility in France, continuing its strategy to boost production despite a slowdown in luxury demand. Bloomberg posted on X, highlighting the company's commitment to growth even as geopolitical tensions, such as the Iran conflict, introduce new uncertainties to the market. Hermès remains focused on expanding its operations, aiming to meet long-term goals despite current challenges in the luxury sector. #Hermès#LeatherGoods#Luxury#Manufacturing#France#Expansion#GlobalUncertainty#LuxuryMarket#BusinessGrowth#Geopolitics

Crypto M - Crypto News

@CryptoM · Post #64541 · 09.04.2026 г., 07:05

🚀 U.S. Dollar Index Remains Stable Amid Middle East Tensions The U.S. Dollar Index (DXY) maintained stability on April 9, despite ongoing uncertainties surrounding the conflict in Iran. According to BlockBeats, the situation remains tense following a two-week ceasefire agreement between the United States and Iran. Iran continues to launch missiles and drones towards Arab nations in the Persian Gulf, while Israel has targeted Hezbollah militants in Lebanon. Iran has also informed mediators of its intention to limit the number of ships passing through the Strait of Hormuz and impose transit fees. Analysts from Commerzbank have expressed concerns, suggesting that the ceasefire may be a fragile pause in the conflict, as it inherently implies further negotiations. #USDollarIndex#MiddleEastTensions#IranConflict#DXY#Ceasefire#StraitOfHormuz#PersianGulf#Israel#Hezbollah#Commerzbank#TransitFees#GlobalUncertainty