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 слични објави

Пребарај: #duckchain

当前筛选 #duckchain清除筛选

🚜First farming pool from Tomarket While we are all waiting for the $TOMA listing and watching the price on the TOMA/USDT premarket, the team launched a farming pool with its first partner — DuckChain. About farming $DUCK Points By staking $TOMA in the Farming Pool, you will secure a spot in the TGE #DuckChain airdrop and will farm $DUCK Points faster than through their mini-app. Not Bad. 🥚 Collect eggs in DuckChain. After staking, head to DuckChain to start farming eggs — these eggs are rare and valuable, so don't miss your chance. 🍅Stake TOMA in the Tomarket farming pool. Once staked, join DuckChain to collect eggs: ✅Join the DuckChain app ✅Subscribe to DuckChain channel ✅Subscribe to DuckChain on X ⚠️Note: If you have trouble with TOMA distribution, don't worry — there will be plenty of time to join after the team completes the review. Rewards will not be affected by whether you enter the pool early or late. 🧐Does it worth to participate? This is probably just the beginning of the project's journey towards onboarding in #GameFi and #memecoins. If the #Tomarket team is really interested in playing for the long term, they should thank early adopters, for their support — give a fat drop to the first pool. If the community does not support the project, this will probably be the end of it. And our $TOMA will be worth nothing. So it's up to you to decide. #fun#belong#money Farming pool DuckChain 🦆

Airdrop Center

@centralchanel · Post #15821 · 04.01.2025 г., 20:20

January Listing 🔥 ✅#Nodepay: 6 January ✅#MomoAi: 6 January ✅#Xterio: 8 January ✅#Sidekick : 8 January ✅ $Vertus :13 January ✅#Seed : 15 January ✅#Xcoin : 20 January ✅#Tapswap : 23 January ✅#Wcoin : 25 January ✅#CommunityGaming : 28 January Unofficial Listing ✅#PAWS ✅#UXUY ✅#Yuligo ✅#MemeWar ✅#DuckChain ✅#Celia Stay connected

Venture Village Wall 🦄

@venturevillagewall · Post #3599 · 20.12.2024 г., 15:25

DuckChain Raises $5M for Web3 DuckChain, a consumer layer for Web3, successfully secured $5M in funding from notable investors including dao5, Offchain Labs, Kenetic, and others. #DuckChain#Web3#Funding#dao5#OffchainLabs#Kenetic#DWFVentures#OakGroveVentures#SkylandVentures#GeekCartel#GateLabs#PrestoLabs#Camelot#Quantstamp

Venture Village Wall 🦄

@venturevillagewall · Post #3600 · 20.12.2024 г., 16:00

DuckChain Secures $5M Funding TON’s consumer layer for Web3 DuckChain has successfully raised $5 million in a funding round with participation from multiple investors including dao5, Offchain Labs, DWF Ventures, and others. #DuckChain#Web3#Funding#TON#dao5#OffchainLabs#DWF#Investors#Ventures#Kenetic#Skyland#GeekCartel#GateLabs#PrestoLabs#Camelot#Quantstamp#Blockchain#Finance#Investment#Technology