@MostInspiring · Post #1966 · 04.04.2024 г., 02:10
Must watch. #MustWatch What matters the most is.. Not who's mistake but whose life
Hashtags
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
Пребарај: #mustwatch
@MostInspiring · Post #1966 · 04.04.2024 г., 02:10
Must watch. #MustWatch What matters the most is.. Not who's mistake but whose life
Hashtags
@MostInspiring · Post #1515 · 16.10.2020 г., 09:01
#MustWatch @MostInspiring Video Click to Join 👇👇👇👇 You will certainly Experience the good Feeling after seeing this Video
Hashtags
@rusembcy · Post #1341 · 21.11.2023 г., 06:17
#MustWatch To fully understand the genesis of the current situation in Ukraine, how the rise of Neo-Nazism came to be and how the far-right Russophobic ideology and groups gained power over a brotherly nation one must take a retrospect view. 📣 World renowned filmmaker and actor, Academy award winner Nikita Mikhalkov tells and explains just that, with proven facts and archival footage to show the truth, in an emergency hour-long episode of his author's programme BesogonTV. The Western mainstream media will never report on these facts, sweeping under the rug anything that damages the current anti-Russian narrative, hoping the audiences have no recollection of the sequence of the events. Watch to jog your memory. Warning: the video contains sensitive images, viewer discretion advised.
Hashtags
@MostInspiring · Post #760 · 04.05.2019 г., 02:51
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️ One of the best videos ever! Absolutely brilliant in conveying the most needed message of today with no words! We wish this video goes viral across India and the world to create an awareness where education is sold. @MostInspiring #MustWatch
Hashtags
@MostInspiring · Post #655 · 31.03.2019 г., 04:49
Will Power #mustwatch @MostInspiring
Hashtags
@MostInspiring · Post #490 · 13.02.2019 г., 15:01
#MustWatch@mybestcollection
Hashtags
@MostInspiring · Post #329 · 23.12.2018 г., 22:37
@MostInspiring #mustwatch
Hashtags
@MostInspiring · Post #313 · 19.12.2018 г., 23:18
#MustWatch @MostInspiring
Hashtags
@positivenewss · Post #232 · 23.06.2020 г., 09:17
What is real kindness #mustwatch @Highimpact
Hashtags
@primevisa_uz · Post #205 · 21.07.2022 г., 04:43
Bizga ham nasib qilsin 🙌 #mustwatch
Hashtags
@positivenewss · Post #143 · 12.04.2020 г., 05:07
Amazing Video 🔗👆 #MustWatch
Hashtags
@MostInspiring · Post #133 · 24.10.2018 г., 00:06
@MostInspiring #MustWatch
Hashtags