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

Резултати

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

Пребарај: #centralafricanrepublic

当前筛选 #centralafricanrepublic清除筛选
RTDocumentary

@rtdocumentary · Post #139 · 25.07.2021 г., 10:00

Testimony of an ex-child soldier #video#CentralAfricanRepublic In the Central African Republic, thousands of children have joined violent militias – either by force, or by choice. Since 2013, the country has been locked in civil war, with several disparate groups fighting each other. Some kids have joined the Christian Anti-balaka group and wear elaborate amulets to protect them against guns. Others fight for Seleka Muslim rebels with AK-47s. As part of a UNICEF-led effort to free child soldiers over the years, thousands of underage soldiers have left the groups. However, children traumatised by war have to go through a rehabilitation process before going home. This child who we filmed for Children of the Front shared his memories. Follow: https://t.me/rtdocumentary

Venture Village Wall 🦄

@venturevillagewall · Post #4111 · 10.02.2025 г., 07:00

Arweave AO Live, CAR Meme Token Launch Arweave’s computing platform AO is now active on its mainnet, enhancing decentralized applications. More info: The Block. In crypto news, the President of the Central African Republic, Faustin-Archange Touadéra, announced the launch of a meme token named CAR, reaching a market cap close to $900 million shortly after release. However, the token's legitimacy is questioned due to reported hacks and potential issues with its announcement video being AI-generated. Further details: Forklog. Analysts forecast significant declines for new token issuances, expecting drops of over 80% post-listing. Read more: Wu Blockchain News. #Arweave#DeFi#Crypto#Token#Market#Launch#CentralAfricanRepublic#MemeToken#Touadera#AI#Analyst#Predict#Listing#Invest#Blockchain#Ethereum#ETH