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

Резултати

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

Пребарај: #canggu

当前筛选 #canggu清除筛选
Bali News

@balinews · Post #559 · 28.01.2026 г., 08:15

🏗 Canggu is getting its first shopping mall 📍 The Canggu Hills project, located along the Canggu–Pererenan road, is set to host the area’s first full-scale mall. 🛍 The two-story complex will accommodate around 200 tenants and follow an outdoor mall concept — more like an open-air shopping district rather than a traditional enclosed mall. 🏘 Canggu Hills itself is designed as a mixed-use development, combining residential and commercial spaces. 📆 The planned opening is June 2028. #places#Canggu@BaliNews

Bali News

@balinews · Post #611 · 25.04.2026 г., 15:35

🛵 Bali plans to change traffic patterns in Berawa and Canggu ℹ️ The focus is on key roads, beach access routes, and popular shortcuts. Authorities aim to redistribute traffic flows to reduce congestion and make movement more balanced. The LLAJ forum — a local traffic council — will be involved in developing the new system. Testing is planned before implementation, so no exact timeline has been announced yet. The updated scheme will include not only main roads but also widely used shortcuts. 📍 A similar model has already been tested and implemented in Kerobokan and Seminyak. No timeline for Canggu yet – calculations and a trial phase will come first. #roads#projects#Canggu@BaliNews

Bali News

@balinews · Post #335 · 27.02.2025 г., 12:16

🪩Morabito presents Bombossa Brothers 📍 Morabito Art Villa, Canggu 📅 Friday, February 28 ⏰ 6:00 pm Bombossa Brothers are twins with two interesting personalities and one mission: to entertain as many people as possible with their groovy melodic sound. Over the past couple of years, they have built up their reputation as a duo to watch by playing around the world and expanding their Momentum event series, hosting up to 2000 people in their hometown of Tallinn, Estonia. 🎫Tickets at the link from 250.000 IDR. @BaliNews #wheretogo#parties#Canggu

Bali News

@balinews · Post #430 · 07.06.2025 г., 12:32

🚤A boat dock will be built at the airport in Canggu 📰 A sea route from the airport to c will appear in Bali. The new dock between Canggu and Chemagi is scheduled to begin operating in 2026, but the first water taxis are planned to be launched in test mode as early as the end of 2025. 👍 The boat trip from the airport to Canggu will take 15 to 30 minutes and will help avoid traffic jams. #goodnews#places#transport#Canggu@BaliNews

Bali News

@balinews · Post #438 · 17.06.2025 г., 12:10

🎬 Movies watching at Alternative Beach 📍 Alternative Beach in Bali’s newest unique daytime hangout, right in the heart of Canggu. June 19 – Mickey 17 June 23 – The Union June 26 – Fly Me to the Moon 🆓 The event of free of charge. 📲 Details and reservation are on the official website. #wheretogo#events#free#Canggu@BaliNews

Bali News

@balinews · Post #429 · 06.06.2025 г., 12:15

🍹The Bali Cocktail Festival 2025 has opened in Bali 📍 The Bali Cocktail Festival 2025 kicked off today at Atlas Beach Club on Berawa Beach and will run until June 8. 🍸 Guests can enjoy pop-up bars, guest sessions with Balinese and international mixologists, cocktail battles, and flair competitions. The cocktails feature Balinese rum, arak, and classic recipes with an island twist. #wheretogo#events#festivals#Canggu@BaliNews

Bali News

@balinews · Post #342 · 06.03.2025 г., 11:16

📍Finns Recreation Club closes for a year 📰 The popular sports and entertainment center Finns Recreation Club has announced a temporary closure for a major renovation. 📆Starting April 1, 2025, the club will suspend operations for 14 months to transform into a global center for fitness, wellness and entertainment. ℹ️ The Finns Recreation Club renovation is not just a facelift, but a global transformation with an investment of more than $15 million dollars. 🔎 By the way, from March 9 to 11, the club will host a number of events (shown in the photo above) among which there are even free events. More details on the club's website. @BaliNews #places#wheretogo#events#free#sport#Canggu