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

Резултати

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

Пребарај: #blockchains

当前筛选 #blockchains清除筛选
Telegram & TON NEWS

@all_telegram_ton_news · Post #22617 · 07.01.2026 г., 08:58

The Daily TON (Telegram) 🔥 EVM vs non-EVM ⚫️ Let's expand on the topic "#blockchains in 2026". If you have interacted with DeFi, you have probably heard the terms "EVM-compatible" or "non-EVM" blockchain. This is not just technical jargon, but a fundamental division that determines which applications can run on the network and who will develop them. ⚫️EVM (Ethereum Virtual Machine) is the Ethereum virtual machine that has become the standard in the crypto world. Blockchains like Polygon, BSC, and Avalanche are EVM-compatible. This means that any smart contract or dApp written for Ethereum can be ported to such networks with almost no changes. The main advantage is compatibility and a huge ecosystem: developers, tools, and users are already there. ⚫️Non-EVM blockchains are networks with their own unique architecture. Bitcoin stands apart without smart contracts. Solana, SUI, TON, and others have created their own virtual machines and programming languages. Their goal is not... View original post

Hashtags

djangoproject

@djangoproject · Post #499 · 14.11.2017 г., 16:33

https://pypi.python.org/pypi/hyperledger/0.1.5 #Python#client for #Hyperledger. This work is licensed under the Apache License, Version 2.0. Hyperledger Project is a new Collaborative Project at The Linux Foundation. The technical community is just getting started and will be adding code to the repository in the coming weeks. Check hyperledger.org for more information about joining the mailing lists and participating in the conversations. #Blockchains