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

Резултати

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

Пребарај: #chinatech

当前筛选 #chinatech清除筛选
AI & Law

@ai_and_law · Post #401 · 20.09.2024 г., 07:04

China Tightens Control Over AI-Generated Content China's Cyberspace Administration has introduced a draft regulation that will require digital platforms to clearly label all AI-generated content. This new regime would mandate visible logos and metadata embedded in texts, images, videos, and audio files created by AI. In some cases, audio content must include voice prompts identifying AI-generation, while videos would display notifications at key points. The proposed rules aim to tighten control over AI-generated material by ensuring accountability. Platforms will also be required to analyze and label any suspicious content that lacks metadata. This move underscores China’s broader vision for stringent regulation of AI technologies and user-generated content, with significant penalties for non-compliance. #AIRegulation#AICompliance#ChinaTech#AIGovernance

ДжекМа Позвонит

@jackmawillcall · Post #95 · 12.03.2020 г., 10:33

China is not showing any sign of a slowdown in building up a national 5G network, even when the coronavirus outbreak has shattered the global supply chain. The total number of 5G base stations will range between 600,000 and 800,000 by the year’s end (c) KrAsia #china#china🇨🇳#5g#technology#tech#chinatech

ДжекМа Позвонит

@jackmawillcall · Post #92 · 11.03.2020 г., 15:38

Didi Chuxing has launched a new intra-city errand service in Chengdu and Hangzhou with a starting rate of RMB 12 (USD 1.72) for the first four kilometers, RMB 20 for a delivery distance of four to 10 kilometers, and RMB 30 for a distance higher than 10 kilometers (c) KrAsia. Be ready for lower prices from Meituan and Eleme soon. #china#didi#delivery#chinatech#chinabusiness

Venture Village Wall 🦄

@venturevillagewall · Post #3999 · 27.01.2025 г., 13:00

SonarWatch Acquired; Bitpanda Gains EU License 🔗 Multichain DeFi tracker SonarWatch acquired by Jupiter. 🔗 Bitpanda secures German MiCA license from BaFin, enabling operations across 27 EU nations and enhancing growth with 6 million users. 🔗 Coinbase CEO advocates for token listing reform amid surge in new tokens, reaching 1 million weekly. 🔗 Nasdaq futures drop nearly 2% as China's DeepSeek AI casts shadow over US tech stocks. 🔗 DeepSeek app tops free downloads in US App Store. 🔗 Trump administration considered handing over TikTok operations to Oracle. 🔗 AI search developer Perplexity proposes TikTok acquisition with 50% future IPO stake for the US government. 🔗 TikTok users in the US report censorship issues post-unblocking. 🔗 Russian lawmakers suggest potential unblocking of foreign social networks if sold to local investors. #DeFi#SonarWatch#Bitpanda#MiCA#Coinbase#AI#DeepSeek#TikTok#Oracle#USStocks#Censorship#NASDAQ#TechNews#Investment#ChinaTech#Innovation#Crypto#VC#USGovernment