TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #191 · 14 дек.

Как разделить строку с shell-командой на отдельные аргументы в виде списка? Если сделать просто сплит по пробелу то получим то что надо, кроме случаев со вставками текста с пробелами. Например так: >>> '-arg "I Am Groot"'.split(' ') ['-arg', '"I', 'Am', 'Groot"'] Чтобы учитывать текст в кавычках как единый аргумент можно воспользоваться функцией shlex.split() Кто читает мой канал давно, уже в курсе. А что делать, если нужно обратное действие? Объединить аргументы из списка в строку и при этом добавить кавычки в аргумент с пробелами. Конечно, если вы используете subprocess то он сам всё разрулит. Но если вам нужна именно команда одной строкой, то можно воспользоваться готовой функцией в том же subprocess. >>> from subprocess import list2cmdline >>> list2cmdline(['-arg', 'I Am Groot']) '-arg "I Am Groot"' Он также позаботится об экранировании уже имеющихся кавычек >>> list2cmdline(['-arg', 'I Am "Groot"']) '-arg "I Am \"Groot\""' А вот так он может "схлопнуть" в команду JSON >>> list2cmdline(['--json', json.dumps({'key': 'value'})]) '--json "{\"key\": \"value\"}"' _______________ Возможно кто-то спросит, а зачем соединять аргументы в строку если subprocess сам это сделает а os.system не наш путь? Мне как-то потребовалось отправлять команду на удалённое выполнение и в API поддерживалось указание команды только строкой. Так что всякое бывает) #libs#basic

Hashtags

Резултати

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

Пребарај: #geopolitical

当前筛选 #geopolitical清除筛选
Addis Standard

@addisstandardeng · Post #21450 · 19.02.2026 г., 08:50

#Ethiopia’s projected double-digit growth tied to #reforms, #exports, #geopolitical risks—Foreign Policy Ethiopia’s projected double-digit economic growth follows recent reforms, export gains, and ongoing geopolitical uncertainties, according to analysis by Foreign Policy Magazine. The magazine said, the National Bank of Ethiopia recently eased foreign-exchange controls to attract investment and improve the business climate, shortly after Prime Minister Abiy Ahmed said the economy could grow 10.2% this fiscal year. The analysis notes that Ethiopia had averaged about 11% annual growth until the Tigray war in 2020 caused an estimated $28 billion in losses and left many reliant on aid. Reforms backed by the International Monetary Fund, including floating the birr and opening banking, telecom, and real estate sectors, reportedly boosted agriculture, mining, and exports despite inflation pressures. Coffee exports exceeded $2.6 billion last fiscal year, with the United States remaining a major market despite Ethiopia’s suspension from AGOA. Exports have also expanded toward Asian and Gulf markets, particularly China. Gold exports surged as well, though the outlet warns this may reflect temporary global price trends. Debt restructuring remains unresolved, with bilateral creditors, including France and China, reportedly complicating negotiations. The magazine also cites a Reuters investigation alleging Ethiopian links to Sudan’s conflict involving the Rapid Support Forces and the Sudanese Armed Forces, claims analysts link partly to tensions with Egypt over the Grand Ethiopian Renaissance Dam. Foreign Policy adds that regional frictions with United Arab Emirates alliances, tensions with Eritrea, and conflicts in the Tigray, Amhara, and Oromia Regions could challenge the country’s economic recovery. https://foreignpolicy.com/2026/02/18/ethiopia-economic-growth-projected-foreign-exchange-controls/

Here is a thought-provoking review essay by Suhasini Haidar in The Hindu about three books authored by Sreeram Chaulia, T.V. Paul and Dhruva Jaishankar, with grand strategy in #ForeignPolicy as the binding theme. Suhasini’s view that Sreeram Chaulia’s ‘Friends’ brings “clarity of thought” to the subject is accurate. Her point about ‘Friends’ not including any neighbouring country of #India is worth reflecting on because the Indian Ministry of External Affairs (MEA) has not signed formal strategic partnerships with countries next door in #SouthAsia. Also, Chaulia’s definition of a consequential strategic partner is a country that helps stretch India’s #geopolitical ambit into distant parts of the world. Please read on and join the debate!