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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #309 · 2 фев.

Метод строки split() разделяет строку на несколько строк по указанному символу >>> "a_b_c".split('_') ['a', 'b', 'c'] Можно указать максимальное количество разделений >>> "a_b_c".split('_', 1) ['a', 'b_c'] Или резать с другой стороны с помощью rsplit() (right split) >>> "a_b_c".rsplit('_', 1) ['a_b', 'c'] А что будет если оставить аргументы пустыми? >>> "a_b_c".split() ['a_b_c'] Получаем список с одним элементом, потому что по умолчанию используется пробельный символ. >>> "a b c".split() ['a', 'b', 'c'] То есть это равнозначно такому вызову? >>> "a b c".split(" ") ['a', 'b', 'c'] Кажется да, но нет! Давайте попробуем добавить пробелов между буквами >>> "a b c".split(" ") ['a', '', '', 'b', '', '', 'c'] И вот картина уже не так предсказуема 😕 А вот что будет по умолчанию >>> "a b c".split() ['a', 'b', 'c'] Всё снова красиво! 🤩 По умолчанию в качестве разделителя используется любой пробельный символ, будь то табуляция или новая строка. Включая несколько таких символов идущих подряд. А также игнорируются пробельные символы по краям строки. >>> "a\t b\n c ".split() ['a', 'b', 'c'] Аналогичный способ можно собрать с помощью регулярного выражения. Но пробелы по краям строки придется обрабатывать дополнительно. >>> import re >>> re.split(r"\s+", ' a b c '.strip()) ['a', 'b', 'c'] Здесь тоже можно указать количество разделений >>> re.split(r"\s+", 'a b c', 1) ['a', 'b c'] А что если мы хотим написать красиво, то есть split() без аргументов, но при этом указать количество разделений? В этом случае первым аргументом передаём None >>> "a\n b c".split(None, 1) ['a', 'b c'] Данный метод не учитывает строки с пробелами, взятые в кавычки 'a "b c" '.split() ['a', '"b', 'c"'] Но для таких случаев есть другие способы. #tricks#basic

Резултати

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

Пребарај: #websockets

当前筛选 #websockets清除筛选
djangoproject

@djangoproject · Post #279 · 20.03.2017 г., 07:42

https://realpython.com/blog/python/getting-started-with-django-channels/#.WLWLY9_IJ0s.linkedin In this tutorial, we will use #Django_Channels to create a real-time application that updates a list of users as they log in and out. Django Channels Logo With #WebSockets (via Django Channels) managing the communication between the client and the server, whenever a user is authenticated, an event will be broadcasted to every other connected user. Each user’s screen will change automatically, without them having to reload their browsers.

djangoproject

@djangoproject · Post #576 · 02.03.2018 г., 12:52

https://www.obeythetestinggoat.com/pages/book.html#toc "Test-Driven Web Development with Python" aims to teach #TDD for web programming. It uses a concrete example — the development of a website, from scratch — to explain the TDD metholology and how it applies to building web applications. It covers the #Selenium browser-automation tool, #unit_testing, mocking, and interacting with Web technologies from the basics of static content, database integration, throught the inescapable JavaScript, and onto more advanced (and trendy) topics like #NoSQL, #websockets and Async programming.

djangoproject

@djangoproject · Post #517 · 08.12.2017 г., 05:27

https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#websocket-servers I've recently been exploring the exciting new world of #asynchronous I/O libraries in Python 3 – specifically asyncio and curio. These two libraries make some different design choices. Example 1: #asyncio, with callbacks Example 2: #curio, with #async/#await Example 3: asyncio, with async/await #websockets

djangoproject

@djangoproject · Post #228 · 16.01.2017 г., 13:11

http://www.aparat.com/v/miNUS pycon 2016- Andrew Godwin - Reinventing Django for the #Real_Time Web Django has long been tied to the #request_response pattern, but the upcoming "#channels" project changes this and allows #Django to natively support #WebSockets, running tasks after responses, easily handle #long_polling and more. Come and learn about the design, how we're trying to keep things as Django-like as possible, and how you can use it in your projects.

GitHub Trends

@githubtrending · Post #15556 · 12.03.2026 г., 12:30

#typescript#ai#ai_agents#coding#deno#embeddings#insforge#nextjs#oauth2#pgvector#postgresql#realtime#vectors#websockets InsForge is an open-source backend platform for AI coding agents, offering easy auth, Postgres database, S3 storage, edge functions, and model gateway via a simple semantic layer. Agents fetch context, configure services, and inspect state to build full-stack apps quickly. Set up locally with Docker or use cloud deploys. It boosts agent accuracy 1.7x, speed 1.6x, and cuts tokens 30% vs. rivals, letting you prototype and ship AI-driven apps faster with less hassle and cost. https://github.com/InsForge/InsForge

GitHub Trends

@githubtrending · Post #15204 · 08.10.2025 г., 11:30

#java#cloud#coap#dashboard#iot#iot_analytics#iot_platform#iot_solutions#java#kafka#lwm2m#microservices#middleware#mqtt#netty#platform#snmp#thingsboard#visualization#websockets#widgets ThingsBoard is an open-source IoT platform that helps manage and analyze data from connected devices. It allows users to collect data, create real-time dashboards, and automate tasks using a powerful rule engine. This platform supports various protocols like MQTT and HTTP, making it easy to connect devices. Users can also define relationships between devices and assets, and trigger alarms based on specific conditions. The benefit is that it simplifies IoT project development, making it scalable and efficient for applications like smart farming, smart offices, and more. https://github.com/thingsboard/thingsboard