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

Резултати

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

Пребарај: #simret

当前筛选 #simret清除筛选
Borkena

@borkena · Post #5509 · 10.12.2025 г., 05:31

Democratic Simret Tigray Gets Official Recognition From Electoral Board. Read more. https://borkena.com/2025/12/10/ethiopia-democratic-simret-tigray-gets-official-recognition-from-electoral-board/#Ethiopia#news#Simret

Addis Standard

@addisstandardeng · Post #21503 · 23.02.2026 г., 14:11

News update: #Tigray Democratic Solidarity rejects HoF decision, threatens to boycott elections and similar ‘illegal acts’ if unresolved Tigray Democratic Solidarity (#Simret) has called on the House of #Federation (HoF) to reconsider its decision to remove electoral constituencies in districts previously under the Tigray region administration, describing the move as “unconstitutional” and warning that it undermines Ethiopia’s federal system. In a letter addressed to both the House of Federation and the National Election Board of Ethiopia (#NEBE), Simret said the decision constitutes an act that “undermines the country’s constitutional order, crushes institutional independence, and effectively declares ‘constitutional anarchy’.” Citing Article 62 of the FDRE Constitution, the party argued that the House of Federation’s powers are limited to constitutional interpretation & the resolution of regional boundary disputes. Simret further argued that boundary... Read more: https://addisstandard.com/?p=55350

Addis Standard

@addisstandardeng · Post #21681 · 11.03.2026 г., 15:03

News: Simret withdraws lawsuit challenging #NEBE decision on five #Tigray constituencies; Getachew Reda says dispute requires political resolution The Tigray Democratic Solidarity (#Simret) party has withdrawn its lawsuit challenging a decision by the National Election Board of #Ethiopia (NEBE) concerning five electoral constituencies in Tigray, party leader #Getachew_Reda confirmed to Addis Standard today. Getachew, who is also Advisor to the Ethiopian Pm, said the party submitted a formal request to the Federal High Court seeking to discontinue the case, arguing that documents presented during earlier proceedings showed that what had been described as a decision of the House of Federation did not constitute a formal institutional ruling made through constitutional procedures. According to him, the document produced in court indicated that the matter reflected the position of officials rather than a decision adopted through the House’s legally required…… Read more: https://addisstandard.com/?p=55753