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

Резултати

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

Пребарај: #limited

当前筛选 #limited清除筛选
电竞红单作业推荐-中文频道

@dianjingtuijian01 · Post #9351 · 12.04.2026 г., 11:23

【#Yunxiao Sports】https://yunxiao61.vip(reputation disk)🥰 (reputation disk)🥰 😀😀😀😀😀 😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀 🤭No IP limit (you can deposit and withdraw via U for the first time)🥰 🤭"Zero review and worry-free for large amounts" 🤭The world's most prestigious betting market from Europe! The platform supports USDT, GOpay, OKpay, EBpay, WeChat, Alipay, virtual currency and other payment deposits and withdrawals👉 (1:1 for member EB sales) 🤭Open an account and get free gifts ✅#Limited time event: first deposit 300 will get you 178. If you deposit 500, you will get 288. 🤭Large customers with a single deposit of 1 million (no need to worry about making large withdrawals). Financial analysts are welcome to compete in Dog Village ❗️ 🤭Important things to say twice: Withdraw money in seconds without stuck money Withdraw money in seconds without stuck money❗️ ⚡️⚡️⚡️⚡️⚡️⚡️ ⚡️⚡️⚡️⚡️⚡️⚡️⚡️ 🤭The daily deposit bonus for the first deposit will not stop, 2% will be given for daily deposit, and more will be given on weekends. There are also monthly cash rebates, etc. 🤭If you meet the deposit requirement of 200,000 within 30 days of registration, you will receive a young model or the latest Apple mobile phone. 🌐Yunxiao Sports:https://yunxiao61.vip 🌐Event Specialist: @qiuxiaomi9876🥰 🤤😪😮‍💨😵😛😝😜🤪🤨🧐🤓😎🥸 🤭e-sports sports agreement to stabilize channels👉✈️@dianjingtuijian01

电竞红单作业推荐-中文频道

@dianjingtuijian01 · Post #9280 · 07.04.2026 г., 09:03

【#Yunxiao Sports】https://yunxiao61.vip(reputation disk) 🥰 (reputation disk) 🥰 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 🤭No IP limit (you can deposit and withdraw via U for the first time) 🥰 🤭"Zero review and worry-free for large amounts" 🤭The world's most prestigious betting market from Europe! The platform supports USDT, GOpay, OKpay, EBpay, WeChat, Alipay, virtual currency and other payment deposits and withdrawals👉 (1:1 for member EB sales) 🤭Open an account and get free gifts ✅#Limited time event: first deposit 300 will get you 178. If you deposit 500, you will get 288. 🤭Large customers with a single deposit of 1 million (no need to worry about making large withdrawals). Financial analysts are welcome to compete in Dog Village ❗️ 🤭Important things to say twice: Withdraw money in seconds without stuck money Withdraw money in seconds without stuck money❗️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ 🤭The daily deposit bonus for the first deposit will not stop, 2% will be given for daily deposit, and more will be given on weekends. There are also monthly cash rebates, etc. 🤭If you meet the deposit requirement of 200,000 within 30 days of registration, you will receive a young model or the latest Apple mobile phone. 🌐Yunxiao Sports:https://yunxiao61.vip 🌐Event Specialist: @qiuxiaomi9876🥰 🤤 😪 😮‍💨 😵 😛 😝 😜 🤪 🤨 🧐 🤓 😎 🥸 🤭e-sports sports agreement to stabilize channels👉✈️@dianjingtuijian01

KizlyarSupreme

@kizlyarsupreme · Post #1287 · 11.03.2025 г., 12:19

Друзья, представляем нож Colada, выпущенный ограниченным тиражом. Colada – это компактный нож-универсал, один из самых популярных в линейке Kizlyar Supreme. Простота, красота, завершенность - и ничего лишнего. Клинок классической формы выполнен из культовой немецкой стали PGK, а рукоять - из прочного черного композита. Сталь PGK на клинке закалена до твердости 62-63 HRC - нож отлично держит заточку и обладает потрясающим резом. Обычно при такой твердости клинки становятся хрупкими, но только не из стали PGK! Если вы хотите совместить: 🔪 отличный рез, 👌 удержание заточки 🗿 и высочайшую прочность, смело выбирайте клинок из PGK. Рукоять с выраженной шероховатой фактурой выполнена из черного G10. Нож комплектуется красивыми и удобными погружными кожаными ножнами с петлей свободного подвеса. Купить в официальном интернет-магазине◀️ #Colada#Limited#PGK

12
ПретходнаСтраница 1 од 2Следна