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

Пребарај: #gambela

当前筛选 #gambela清除筛选
Addis Standard

@addisstandardeng · Post #21268 · 01.02.2026 г., 09:18

News: #UK bans all travels to #Tigray, #Amhara, and #Gambela regions, issues sweeping warnings across Ethiopia The British government has significantly expanded its travel warnings for #Ethiopia, banning all travels to Tigray, Amhara and Gambella regions and advising against travels to several regions and large border areas owing to deteriorating security conditions. In its latest advisory, the UK Foreign, Commonwealth & Development Office (#FCDO) stated: UK nationals are advised against all travel to Tigray region, where recent reports show militarized tensions in various places. UK’s travel warning also bans all travels to Amhara region, where a war between government and the Fano armed groups remained active since it first broke in 2023; and Gambela region, where renewed clashes saw scored killed and schools shuttered. The advisory also extends to all areas within 10 kilometers of Ethiopia’s border with #Eritrea, and within 20 kilometers of the …. Read more: https://addisstandard.com/?p=54877

Addis Standard

@addisstandardeng · Post #21303 · 04.02.2026 г., 09:18

News: #Australia issues ‘do not travel’ advisory for #Tigray, #Amhara, and other regions in #Ethiopia The Australian government has issued a “do not travel” advisory for Ethiopia’s Tigray regional state, warning that the security situation could deteriorate rapidly with little or no warning, according to its latest update on the Smartraveller travel advisory platform. In the update, Australian authorities urged their citizens currently in Tigray to leave when it is safe to do so using commercial means, noting that Australia’s ability to provide consular assistance in the region remains “extremely limited.” Travelers were also advised to follow local authorities’ instructions and to shelter indoors in the event of civil unrest or armed conflict. Beyond Tigray, Australia continues to advise against all travel to the Amhara, #Benishangul-Gumuz, and #Gambela regional states, as well as border areas with #Eritrea, #Sudan, #South_Sudan, #Kenya, and #Somalia,.... Read more: https://addisstandard.com/?p=54924

Ethio-Veterinary- vacancy

@vetjobethiopia · Post #44 · 07.12.2023 г., 14:50

Area Sales Manager #ethiochicken_ethiopia #business #Bule | #Ambo | #Gambela | #Ginir | #Hosaena | #Yirgachefe | #Sheno BSc Degree in Animal Science, Veterinary field of study Duties & Responsibilities: - Develop specific plans to ensure sales growth agent appointment in the territory - Map how to achieve sales volume through prioritizing to make big achievement with minimum effort and shorter time Quanitity Required: 20 Minimum Years Of Experience: #0_years Deadline: December 16, 2023 How To Apply: Submit your applications (Cover Letter) including a detailed CV via email: [email protected] N.B: Please title your application with the subject line: - " Area Sales Manager" and Specify the area you are applying for