@TFGames · Post #2172 · 16.02.2024 г., 21:41
#PANDEMIC #8 #BALL#POOL#GAMES https://testflight.apple.com/join/fFYcLcjG
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
Пребарај: #pandemic
@TFGames · Post #2172 · 16.02.2024 г., 21:41
#PANDEMIC #8 #BALL#POOL#GAMES https://testflight.apple.com/join/fFYcLcjG
@reutersworldchannel · Post #149253 · 12.10.2021 г., 14:32
Bali surf school owner eagerly awaiting imminent return of foreign tourists A Bali surf school owner is pinning hopes on Indonesia's plan to reopen the island to some foreign tourists from mid-October, after her business suffered due to a lockdown. #Bali#Indonesia#Lockdown#Pandemic#BaliSurfing#Tourism#News#Reuters Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖
@reutersworldchannel · Post #149302 · 13.10.2021 г., 13:17
October 13, 2021: Gabby Petito, Texas Governor, Debt ceiling fix, U.S borders, La Palma Volcano October 13, 2021: Gabby Petito, Texas Governor, Debt ceiling fix, U.S borders, La Palma Volcano 1. Gabby Petito, the young woman who vanished on a road trip with her boyfriend and later turned up dead in Wyoming, was killed by strangulation, a local coroner said. 2. Texas Governor Greg Abbott's ban on COVID-19 vaccine mandates will likely be superseded by the Biden administration's plan to require shots for workers, but the dueling rules could take months to sort out in court, creating uncertainty for employers with business in the state. 3. The Democratic-controlled U.S. House of Representatives gave final approval to legislation temporarily raising the government's borrowing limit to $28.9 trillion, pushing off the deadline for debt default only until December. 4. The United States will lift restrictions at its land borders with Canada and Mexico for fully vaccinated foreign nationals in early November, ending historic curbs on non-essential travelers in place since March 2020 to address the COVID-19 pandemic. 5. Over 700 residents were ordered to abandon their homes on the Spanish island of La Palma as red-hot lava advanced towards their neighborhood. #GabbyPetito #Wyoming #TexasGovernor #Covid19 #Vaccines #Biden #Democrats #Republicans #UnitedStates #Debt #Canada #Mexico #Borders #Pandemic #LaPalma #Spain #Volcano #News #Reuters Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖