TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #183 · 23 ное.

Python + bash Если вам часто требуется запускать shell команды из Python-кода, какой способ вы используете? Самый низкоуровневый это функция os.system(), либо os.popen(). Рекомендованный способ это subprocess.call(). Но это всё еще достаточно неудобно. Советую обратить своё внимание на очень крутую библиотеку sh. Что она умеет? 🔸 удобный синтаксис вызова команд как функций # os import os os.system("tar cvf demo.tar ~/") # subprocess import subprocess subprocess.call(['tar', 'cvf', 'demo.tar', '~/']) # sh import sh sh.tar('cvf', 'demo.tar', "~/") 🔸 простое создание функции-алиаса для длинной команды fn = sh.lsof.bake('-i', '-P', '-n') output = sh.grep(fn(), 'LISTEN') в этом примере также задействован пайпинг 🔸 удобный вызов команд от sudo with sh.contrib.sudo: print(ls("/root")) Такой запрос спросит пароль. Чтобы это работало нужно соответствующим способом настроить юзера. А вот вариант с вводом пароля через код. password = "secret" sudo = sh.sudo.bake("-S", _in=password+"\n") print(sudo.ls("/root")) Это не все фишки. Больше интересных примеров смотрите в документации. Специально для Windows💀 юзеров #libs#linux

Hashtags

Резултати

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

Пребарај: #chinada

当前筛选 #chinada清除筛选
Hong Kong Democracy Movement

@hkdmovement · Post #8188 · 23.01.2026 г., 05:22

Mark Carney visited China a few days ago. The results don’t seem particularly impressive, and even left-leaning media outlets are expressing a noticeable sense of skepticism. What I’m actually focusing on is that, from the very start of the election, he has appeared to have unusually close ties with the CCP. Even before the election, Canadian media had repeatedly reported on CCP influence in Canada’s electoral process. During Mark Carney’s campaign, he somehow identified a foreign enemy and rolled out the “Elbows Up” slogan. No one knows what set Trump off, but he kept pouring fuel on the fire. Michael Ma’s sudden party switch further highlights how evident the relationship is between, Democrats & CCP. The reality is that Canada’s economy is heavily dependent on North America. Its EV deal with China would actually weaken domestic auto industry. That’s why, immediately, Doug Ford said he would resist Chinese EVs. It looks like Canada will continue to be trapped in a strategic dilemma. #CCP#Chinada

Hashtags

Hong Kong Democracy Movement

@hkdmovement · Post #8182 · 23.01.2026 г., 05:09

Mark Carney 幾日前訪問中國。成果唔見得好大,相反就算左媒都好有一種懷疑態度。 但係我着眼嘅其實係佢由選舉,一開始已經同中共有眉來眼去。其實喺選舉之前已經有加拿大嘅媒體不斷報道講緊中共喺加拿大選舉嘅影響。 然後Mark Carney嘅選舉攻勢,some how,就搵一個外國敵人,然後作個Elbows up嘅口號。又唔知Trump發咗咩神經,不斷火上加油。 Michael Ma突然轉黨更加睇得出加拿大民主黨同中共嘅關係非常明顯。 其實加拿大嘅經濟係非常側重於北美,而佢同中國嘅EV deal,反而會削弱咗加拿大汽車產業。所以,訪問完結,安省嘅Doug Ford即刻話會抵制中國EV。睇嚟加拿大會繼續陷入於兩難嘅局面。 #中共#Chinada

Hong Kong Democracy Movement

@hkdmovement · Post #7968 · 17.04.2025 г., 04:08

As the Canadian federal election heats up, concerns about foreign interference are making headlines. Conservative candidate Joe Tay from Don Valley North has reported widespread vandalism of his campaign signs, while Liberal candidate Peter Yuen from Markham—Unionville faces allegations of being a target of the #CCP United Front efforts. Reports suggest Yuen attended a Beijing military parade and stayed in a five-star hotel, raising questions about CCP infiltration and its influence on Canadian politics. #CanadaElection#JoeTay#PeterYuen#CCPInfiltration#Chinada 隨著加拿大聯邦大選進入白熱化階段,有關外國干預的擔憂成為焦點。多倫多當河谷北選區的保守黨候選人鄭敬基報告其競選宣傳牌遭到大規模破壞,而萬錦於人村選區的自由黨候選人源植勉則被指控為中共統戰對象。報道稱,源植勉曾參加北京閱兵儀式並入住五星級酒店,引發對中共滲透及其對加拿大政治影響的質疑。 #加拿大大選#鄭敬基#源植勉#中共滲透#外國干預#加拿大政治