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

Резултати

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

Пребарај: #austria

当前筛选 #austria清除筛选
Voyage.Travel.Tourism

@VOYAGE · Post #819 · 19.03.2024 г., 15:04

Austria,Hallstatt🇦🇹 Nestled amidst majestic mountains and overlooking a serene lake, Hallstatt captivates with its fairytale-like beauty. 🗻 Explore its historic streets, visit the iconic Hallstatt Skywalk for breathtaking views, and immerse yourself in the rich culture of this enchanting Alpine village. A must-visit destination for nature lovers and history enthusiasts alike! 🏞️ #Austria @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #790 · 05.03.2024 г., 13:05

Austria🇦🇹 This dizzying staircase is part of the via ferrata on Mount Donnerkogel in Austria. 🪜 "The Stairway to Heaven" is 40 meters long. It is located 700 meters above the ground. "The Stairway to Heaven" got its name because in most cases in photographs it looks exactly like that – as something leading from nowhere to nowhere. 🌥 #Austria @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #651 · 22.12.2023 г., 06:02

Austria, Hallstatt 🇦🇹 Hallstatt (Austria) is a small village that is not easy to reach, but every year thousands of tourists dream of coming here. There is something mesmerizing and fairy-tale-like about this tiny settlement. 🏡 The population numbers less than eight hundred people. For such a long time, the area of Hallstatt has not expanded – it's impossible because the settlement is surrounded by cliffs and lakes. ⛰🌳 The Austrian village impresses and delights visitors so much that guests from China decided to build a replica of it in the Guangdong province. Initially, the authorities were against such an idea, but after the project was implemented, the influx of guests increased manyfold, which had a positive impact on the financial situation of the Austrian attraction. #Austria @voyage

Hashtags

Papa & Vaticano - News

@papaevaticanonews · Post #9551 · 05.03.2026 г., 11:46

Nella mattinata di oggi, Papa #LeoneXIV ha ricevuto in udienza, nel Palazzo Apostolico Vaticano, il Presidente della Repubblica d’#Austria, Alexander Van der Bellen, il quale si è successivamente incontrato con il Cardinale Pietro Parolin, Segretario di Stato di Sua Santità, accompagnato da mons. Paul Richard Gallagher, Segretario per i Rapporti con gli Stati e le Organizzazioni Internazionali. "Nel corso dei cordiali colloqui in Segreteria di Stato - si legge in una nota diffusa dalla Sala Stampa vaticana -, è stato espresso compiacimento per le buone relazioni che intercorrono tra la Santa Sede e l’Austria, sottolineando il contributo positivo della Chiesa Cattolica alla promozione del bene comune della società, si è pure accennato ad alcuni temi di particolare attualità, quali la migrazione e il rapporto tra le religioni. Nel prosieguo della conversazione ci si è soffermati su temi di attualità internazionale, in particolare sulle situazioni di conflitto, auspicando un maggiore ruolo della Comunità internazionale nella ricerca di soluzioni pacifiche".

Opportunities with Zula

@opportunities_zula · Post #482 · 04.11.2025 г., 09:42

Leadership and Diplomacy Summit 2026 in Austria 🇦🇹 (Fully Funded) Apply: https://opportunitiescorners.com/leadership-and-diplomacy-summit-in-austria/ Happening at the Diplomatic Academy of Vienna. Organized by the School of Leadership and Diplomacy (SLD). The Program Covers Airfare, Accommodation, Meals, Invitation Letter, Site Seeing, Cultural Celebration. #Austria#OpportunitiesCorners

Opportunities with Zula

@opportunities_zula · Post #377 · 17.10.2025 г., 13:32

Leadership and Diplomacy Summit 2026 in Austria 🇦🇹 (Fully Funded) Apply: https://opportunitiescorners.com/leadership-and-diplomacy-summit-in-austria/ Happening at the Diplomatic Academy of Vienna. Organized by the School of Leadership and Diplomacy (SLD). The Program Covers Airfare, Accommodation, Meals, Invitation Letter, Site Seeing, Cultural Celebration. #Austria#OpportunitiesCorners

Communia

@communia · Post #37707 · 17.12.2023 г., 09:23

#Austria o como el apoyo económico militar a #Ucrania se ha normalizado como moneda de cambio en las batallitas entre los estados/capitales nacionales de los países miembros y la #UE https://www.reuters.com/world/europe/austria-backs-eu-russia-sanctions-after-ukraine-removes-raiffeisen-blacklist-2023-12-16/

ПретходнаСтраница 1 од 5Следна