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

Резултати

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

Пребарај: #single

当前筛选 #single清除筛选
Андрей Лаупер

@free4ones · Post #545 · 29.08.2024 г., 06:24

📻 Годы работы в эфире музыкальных радиостанций не проходят бесследно - тяга к микрофону и к свежим реализам не исчезает😎 💿 Свежий летний попсовый сингл из чарта UK TOP 40: Fred again.. / Anderson .Paak / CHIKA - Places To Be Британцы в очередной раз удивляют своей прогрессивностью и технологичным продакшном. #single#summer

探索号

@seeker_rc · Post #19839 · 07.05.2026 г., 03:25

大家是怎么管理和检索 SingleFile 保存的网页的? 长期都是用 single file 保存网页,但发现自己想用的时候,却始终找不到自己保存,目前想到的解决方案是自动 rag 清洗检索,但总觉得这玩意儿之前应该有人做过了吧 via V2EX 分享创造 标签: #网页#SingleFile#single ⚡️探索号频道 ⚡️探索者频道 ⚡️探索者交流群 ⚡️ Youtube 频道:科技探索者 每天推荐有趣内容,欢迎订阅、转发。

djangoproject

@djangoproject · Post #107 · 02.08.2016 г., 15:22

https://github.com/python/asyncio The #asyncio#module provides infrastructure for writing #single-threaded concurrent code using #coroutines, #multiplexing#I/O access over sockets and other resources, running network clients and servers, and other related primitives. Here is a more detailed list of the package contents: a pluggable event loop with various system-specific implementations; transport and protocol abstractions (similar to those in Twisted); concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and others (some may be system-dependent); a Future class that mimics the one in the concurrent.futures module, but adapted for use with the event loop; #coroutines and #tasks based on yield from (PEP 380), to help write concurrent code in a sequential fashion; cancellation support for Futures and coroutines; synchronization primitives for use between coroutines in a single thread, mimicking those in the #threading module; an interface for passing work off to a threadpool, for times when you absolutely, positively have to use a library that makes blocking I/O calls. Note: The implementation of asyncio was previously called "Tulip".

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #6008 · 10.12.2024 г., 12:03

. . . . . #crusheverything#crush#crushlovers#sendthistoyourcrush#crushmemes#crushrejection#crush😍#crushquote#love#lovecrush#singlelifeproblems#singlefriends#singleme#singlelifebelike#singlemen#singleboy#single#boyswillbeboys#boystory#boysdream#boyslife#boyscanrelate#relatable#relatablememes#reelsinstagram#reelfeelit#explore#exploremoretogether

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5425 · 12.10.2024 г., 05:03

Earphone laga lena bhai 🎧 . #crusheverything#crush#crushlovers#sendthistoyourcrush#crushmemes#crushrejection#crush😍#crushquote#love#lovecrush#singlelifeproblems#singlefriends#singleme#singlelifebelike#singlemen#singleboy#single#boyswillbeboys#boystory#boysdream#boyslife#boyscanrelate#relatable#relatablememes#reelinstagram#reelfeelit#explore#exploremore