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

Резултати

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

Пребарај: #environment

当前筛选 #environment清除筛选
Indian Development News 🇮🇳

@developmentnewsindia · Post #44274 · 01.05.2026 г., 07:48

During the 09 years period (2018-2026) for Delhi, the month of April witnessed its lowest monthly average AQI of 178 in the current year 2026 (barring 2020 - the year of lockdown due to Covid): Commission for Air Quality Management #Environment

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43900 · 21.04.2026 г., 20:37

Tata Steel pilots HIsarna tech with ~50% lower capex and ~50% CO₂ reduction. 1 MTPA demo plant planned at Jamshedpur with ₹4,000 cr capex vs ₹9,000 cr blast furnace baseline. CO₂ cut up to 80% with CCS; commercialization targeted ~2030. #Environment https://t.co/fc7NwWIvTP

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43470 · 11.04.2026 г., 16:02

An unprecedented weather event was witnessed in Jammu, where a tornado struck the area for nearly 10 minutes in Akhnoor. No damage to life or property has been reported. This marks the first recorded instance of a tornado in the region’s weather history. #Environment

Hashtags

No Midjourney

@midjourney · Post #4497 · 04.08.2023 г., 15:07

Discord @webartstd Midjourney #environment minimalistic room, hitech, future, night, neon, rtx, ultra realistic, realistic photo, 8k, 52mm subscribe • free midjourney

Hashtags

No Midjourney

@midjourney · Post #4493 · 03.08.2023 г., 15:16

Discord @smileswe Midjourney #environment Francis henri de roche, julieta london, in the style of detailed fantasy art, imaginative prison scenes, dark blue and gold, trompe - l'œil illusionistic detail, intricate cityscapes, rustic renaissance realism subscribe • free midjourney

Hashtags

No Midjourney

@midjourney · Post #4465 · 29.07.2023 г., 12:02

Discord @ack666 Midjourney #environment Luxury pop - up style bedroom, gold details, small room, chic chandelier, photorealistic, cinematic, ultra realistic, 8K detailing, 3d render, ruby details subscribe • free midjourney

Hashtags

No Midjourney

@midjourney · Post #4441 · 25.07.2023 г., 09:05

Discord @Antixian Midjourney #environment top-down view, a peaceful japanese koi pond, wooden bridge, rocks, plants, bamboo, raked sand, natural lighting, highly detailed subscribe • free midjourney

Hashtags

No Midjourney

@midjourney · Post #4437 · 24.07.2023 г., 09:20

Discord @damen_joseph Midjourney #environment sci fi control room huge room futuristic sensors computers screens maps subscribe • free midjourney

Hashtags

No Midjourney

@midjourney · Post #4409 · 20.07.2023 г., 09:08

Discord @Nikruz Midjourney #environment Map of fantasy land, two main buildings, one castle and one house, 2 big chests full of gold, graphiti style, vibrant colors, birds eye view, colourful subscribe • free midjourney

Hashtags

123•••1011
ПретходнаСтраница 1 од 11Следна