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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #22 · 19 јан.

Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: names = [ 'image.bmp', 'second.txt.bkp', 'data.db', '.config.cfg', 'file.ext.bkp' ] И мы хотим убрать у них окончание ".bkp". Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное. Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip(). Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк). В нашем случае будет выглядеть вот так: >>> name.strip('.bkp') То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть. Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный. >>> for name in names: >>> print(name.strip('.bkp')) image.bm second.txt data.d config.cfg file.ext Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp' А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке. Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'. Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку. >>> for name in names: >>> print(name.replace('.bkp', '')) image.bmp second.txt data.db .config.cfg file.ext Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем. Просто впредь будьте внимательны с этим strip(). #basic

Hashtags

Резултати

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

Пребарај: #python3

当前筛选 #python3清除筛选
Data Science Jobs

@datasciencejobs · Post #1474 · 18.05.2023 г., 18:03

#job#remote#django4#python3 В IT стартап требуется Middle+ Python разработчик Формат работы: - удалённая Занятость: - фулл-тайм (удаленно) Компания: - CIAT International Ссылка на ресурс компании: - pick2me.com Зарплатная вилка: - $2000-$2500 Описание вакансии: Привет, мы – IT стартап Pick2Me. Сейчас мы в поисках коллеги, который станет частью нашей команды. Ищем человека, который всей душой любит свое дело. Если ты инициативный, амбициозный, открытый к новым знаниям и вызовам, то милости просим 😉 Стэк технологий python: - Python 3 и Django 4. - Django REST Framework. - Git, gitflow. - Redis , Celery, Centrifugo and Postgres. - Docker and Docker compose. Контакты: @mianastiia Гетьман Анастасия Не забудь уточнить, что ты из @datasciencejobs

djangoproject

@djangoproject · Post #582 · 17.03.2018 г., 05:18

http://www.paulbrownmagic.com/blog/vslambda Python has support for #lambda functions, Haskell is built upon lambda calculus. The two are not the same and this is the reason why lambda should have been removed in #Python3. This post examines the differences, reviews the use in Python, and offers a more pythonic, honest syntax. #learn

GitHub Trends

@githubtrending · Post #15221 · 14.10.2025 г., 13:30

#python#agent#context_engineering#electron#embedding_models#memory#proactive_ai#python#python3#rag#react#vector_database#vision_language_model MineContext is a special AI tool that helps you work more efficiently. It collects information from your computer screen and other sources, then uses this data to give you useful insights, summaries, and reminders. This helps you stay organized and focused on important tasks. MineContext is also very private because it stores all your data on your local device, not in the cloud. It's like having a personal assistant that helps you manage your digital life better. https://github.com/volcengine/MineContext

GitHub Trends

@githubtrending · Post #15254 · 31.10.2025 г., 11:30

#python#agent_framework#data_analysis#deep_research#deep_search#llms#multi_agent_system#nlp#public_opinion_analysis#python3#sentiment_analysis You can use the "Weibo Public Opinion Analysis System" (called "微舆") to automatically analyze public opinion from over 30 major social media platforms and millions of comments. It uses AI agents working together to monitor, search, analyze text and videos, and generate detailed reports based on real-time data. The system supports easy setup, custom models, and integration with your own databases, helping you understand public sentiment, trends, and make better decisions. It offers continuous monitoring, deep multi-angle analysis, and flexible report generation, all accessible by simply asking questions like chatting. This saves you time and gives clear insights into public opinion dynamics. https://github.com/666ghj/BettaFish

GitHub Trends

@githubtrending · Post #15547 · 07.03.2026 г., 13:30

#python#agent_memory#financial_forecasting#future_prediction#knowledge_graph#llms#multi_agent_simulation#public_opinion_analysis#python3#social_prediction#swarm_intelligence MiroFish is a simple AI tool that predicts anything by creating a digital world from your data like news, policies, or stories. Upload seed info and describe what you want to predict; it builds thousands of smart agents with personalities and memories to interact, simulate futures, and give you a detailed report plus chat access. You benefit by testing decisions risk-free—like policy impacts or story endings—making smart choices or fun ideas win through safe, accurate previews. https://github.com/666ghj/MiroFish

GitHub Trends

@githubtrending · Post #14721 · 19.05.2025 г., 12:01

#python#cli#cti#cybersecurity#forensics#hacktoberfest#information_gathering#infosec#linux#osint#pentesting#python#python3#reconnaissance#redteam#sherlock#tools Sherlock is a powerful tool that helps you find social media accounts by username across over 400 networks. It's easy to use and works on many operating systems like macOS, Linux, and Windows. You can install it using methods like `pipx` or Docker, and then simply type the username you want to search for. Sherlock will show you where that username is used on different social media platforms. This tool is useful for gathering information quickly and can be run locally or even online through services like Apify. It saves time and effort in finding accounts across many platforms. https://github.com/sherlock-project/sherlock

GitHub Trends

@githubtrending · Post #14761 · 29.05.2025 г., 13:00

#python#api#async#asyncio#fastapi#framework#json#json_schema#openapi#openapi3#pydantic#python#python_types#python3#redoc#rest#starlette#swagger#swagger_ui#uvicorn#web FastAPI is a modern Python web framework for building fast, reliable APIs that is easy to learn and quick to code, making it ready for production use right away. It uses standard Python type hints, which means you get automatic data validation, fewer bugs, and great editor support with code completion and type checks. FastAPI also generates interactive documentation automatically, so you and your team can understand and test your API easily. The main benefit is that you can develop robust, high-performance APIs much faster and with less effort, while reducing errors and making your code easier to maintain[1][2][3]. https://github.com/fastapi/fastapi

GitHub Trends

@githubtrending · Post #15436 · 25.01.2026 г., 12:00

#python#amd#anime#compression_artifact_reduction#deep_learning#directx_12#gui_application#intel#manga#noise_reduction#nvidia#onnx#onnxruntime#opencv#python#python3#pytorch#super_resolution#video#video_processing#windows QualityScaler is a free Windows AI app that upscales, enhances, and denoises your images and videos with a simple drag-and-drop GUI. It supports formats like JPG, PNG, MP4, MKV; works offline on any DirectX12 GPU (4GB+ VRAM, 8GB RAM); and offers features like multi-GPU use, resize, interpolation, and stop/resume. Download from itch.io, Steam, or GitHub. Benefit: Quickly turn low-quality photos/videos into sharp HD masterpieces privately on your PC, saving time and money vs. online tools. https://github.com/Djdefrag/QualityScaler