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

Резултати

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

Пребарај: #d3vxr

当前筛选 #d3vxr清除筛选
D3VXR verified

@d3vxrverified · Post #61 · 15.04.2026 г., 16:27

Welcome to the D3VXR Arcade 🎮⚡ Featuring Lucky Block Rush: Pick blocks. Stack points. Push your luck. But one wrong move… 💥 BUST. Risk vs reward at its best. #D3VXR#GameFi

D3VXR verified

@d3vxrverified · Post #16 · 23.05.2025 г., 16:13

The building never stops. 🔧⚡️ At D3VXR.app, every update pushes us closer to a seamless GameFi world. 🔁 Powered by $DGXR — where games, tokens, and player ownership collide. Web3 isn't waiting. We’re building it. #D3VXR#GameFi#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #21 · 27.05.2025 г., 00:42

🚨 GameFi is changing — and D3VXR.app is at the center of it. 🎮 We’re not just building a game. We’re building a Web3-powered ecosystem where you can: ⚔️ Play PvP 💰 Stake and Earn 🎲 Compete with real rewards 🔗 Powered by $DGXR on Solana 🔍 Want to understand the vision? Read more: https://d3vxr.app/about This is just the beginning. Let’s shape the future of GameFi together. 🌐🔥 #D3VXR#DGXR#GameFi#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #17 · 24.05.2025 г., 21:29

A game on d3vxr.app platform loading... Sol Dice Wars Update Incoming! ⚔️🎲 The battlefield is nearly complete... ✅ Lobby creation ✅ Turn-based dice rolls ✅ PvP attacks + expressions ✅ Buffs in effect ⚒️ Card system, nearly forged This isn't just a game — it's strategy on-chain. 👀 Preview the chaos. #D3VXR#SolDiceWars#GameFi#Web3Gaming#GAMEFI#crypto#web3

D3VXR verified

@d3vxrverified · Post #24 · 30.05.2025 г., 02:50

🔑 Utility is what separates real projects from the noise. $DGXR is more than a token — it's the engine behind the D3VXR platform. From games to crypto activities, every feature has a purpose. D3VXR isn’t here to ride hype. It’s here to build useful Web3 experiences on Solana. Check it out: https://d3vxr.app #DGXR#D3VXR#CryptoUtility#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #23 · 29.05.2025 г., 04:08

🚀 The Power of Utility-Driven Tokens: Why $DGXR Matters In a sea of hype tokens, $DGXR stands apart — because it’s built for real use, real players, and real rewards. 🎮D3VXR.app is more than a platform. It’s a living Web3 gaming ecosystem where: ✅ Every $DGXR token gives you access to games and challenges ✅ Win battles, earn more $DGXR — use it, don’t just hold it ✅ Buy, trade, and level up NFTs with actual in-game value ✅ Shape the future — $DGXR gives you power in the ecosystem ⚡️ This isn’t speculation. It’s participation. D3VXR is designed from the ground up to reward time, skill, and strategy — powered by $DGXR. 👉 Dive in: https://d3vxr.app 🔗 Join the revolution. Play to earn, not just to play. #D3VXR#DGXR#Web3Gaming#GameFi#Solana#UtilityToken