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

Резултати

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

Пребарај: #peacenegotiations

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

@CryptoM · Post #65310 · 12.04.2026 г., 20:05

🚀 Global Markets Brace for Volatility Amid Renewed Iran Conflict Concerns The potential resurgence of conflict in Iran following unsuccessful peace negotiations is raising concerns about increased volatility in global markets. Bloomberg posted on X that the recent fragile ceasefire had previously led to a significant rise in stock prices and a notable decrease in oil prices, marking the largest shifts seen this year. However, with the peace talks failing, market stability is once again under threat, prompting investors to brace for potential fluctuations. #GlobalMarkets#Volatility#IranConflict#PeaceNegotiations#OilPrices#StockMarket#Investors#MarketStability

Crypto M - Crypto News

@CryptoM · Post #65376 · 13.04.2026 г., 03:04

🚀 AI Technology Presents New Opportunities Amid Potential Financial Crisis On April 13, Liquid Capital founder Yi Lihua expressed optimism about the potential resolution of ongoing conflicts, noting that motivations for continued warfare are diminishing. According to BlockBeats, Yi emphasized that peace negotiations typically evolve from disagreement to consensus, suggesting that the conflict may gradually come to an end. He remarked that both sides have no reason to continue fighting, and the moment an agreement is reached could signal a positive market shift. Yi highlighted that, in the medium to long term, the market is anticipating a potential large-scale financial crisis. He observed defensive strategies in the financial sector, such as major capital holding high cash ratios and sovereign entities increasing gold reserves. In this context, if another crisis occurs, it will be a crucial test for Bitcoin's status as a safe-haven asset and may offer significant opportunities for low-level investment. Furthermore, Yi Lihua believes that AI technology is creating new opportunities for talented entrepreneurs. He noted that small teams can develop global products, reducing costs associated with financing and organizational management. Experienced serial entrepreneurs, in particular, should seize the opportunities presented by this "AI Age of Exploration." #AI#FinancialCrisis#Investment#Bitcoin#Entrepreneurship#Innovation#MarketOpportunities#Technology#PeaceNegotiations#GlobalProducts#BTC

Crypto M - Crypto News

@CryptoM · Post #65062 · 10.04.2026 г., 17:45

🚀 Iran's Leadership Revamp Amid Peace Talks with the US The ongoing conflict in Iran has prompted significant changes in the nation's leadership structure. Bloomberg posted on X that the Revolutionary Guards are set to play a pivotal role in the upcoming peace negotiations with the United States this weekend. This shift in power dynamics underscores the growing influence of the Revolutionary Guards in Iran's political landscape. The talks are expected to address key issues surrounding the conflict and aim to establish a framework for peace. Observers are closely watching how the involvement of the Revolutionary Guards will impact the discussions and the potential outcomes of these negotiations. #Iran#LeadershipRevamp#PeaceTalks#RevolutionaryGuards#USIranRelations#PoliticalLandscape#ConflictResolution#IranPolitics#PeaceNegotiations

Crypto M - Crypto News

@CryptoM · Post #65331 · 12.04.2026 г., 23:34

🚀 Middle East Nations Urge U.S. and Iran to Resume Talks After Failed Peace Negotiations According to BlockBeats, on April 13, The Wall Street Journal reported that following unsuccessful marathon peace talks in Islamabad, Middle Eastern countries are urging the United States and Iran to return to negotiations. Despite both sides issuing strong statements, diplomatic channels remain open, and a second round of talks could occur within days. Regional nations are in discussions with the U.S. to extend the fragile two-week ceasefire announced on Tuesday evening. Iranian officials have proposed alternative suggestions, such as continuing symbolic uranium enrichment activities or reducing their enriched uranium stockpile, but no compromise has been reached. #MiddleEast#USIranTalks#PeaceNegotiations#Diplomacy#Ceasefire#IranUranium#BlockBeats#Islamabad#Iran#MiddleEasternNations#WallStreetJournal