@kivrac · Post #4800 · 25.01.2026 г., 04:35
一名男子在明尼阿波利斯被边境巡逻人员击毙。国土安全部称该男子携带武器。#ICE
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #121 · 20 јул.
Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django
Пребарај: #ice
@kivrac · Post #4800 · 25.01.2026 г., 04:35
一名男子在明尼阿波利斯被边境巡逻人员击毙。国土安全部称该男子携带武器。#ICE
Hashtags
@laltrafacciadellimpero · Post #3149 · 25.01.2026 г., 16:29
Ejecución pública, por la espalda, a sangre fría, de un ciudadano estadounidense. "Dejen a los patriotas de #ICE hacer su trabajo" dice Trump. Segui e diffondi il canale: https://t.me/laltrafacciadellimpero
Hashtags
@Ultimorapolitics24 · Post #51848 · 05.02.2026 г., 20:55
Milano Cortina: #Meloni definisce "una polemica surreale" la contestazione sulla presenza del #ICE alle Olimpiadi di Milano e Cortina. A 'Dritto e Rovescio' ha detto che la sezione investigativa dell’Homeland Security esiste dal 2002, non svolgerà operazioni di polizia in Italia e "È una polemica strumentale perché la sinistra è un po' a corto di argomenti" @UltimoraPolitics24
@trumpsear_tg · Post #2066 · 28.01.2026 г., 00:01
A federal appeals court sided with the Trump administration Monday in a ruling that blocks restrictions on tactics being used by U.S. Immigration and Customs Enforcement (ICE) agents while dealing with anti-ICE agitators in Minnesota. The ruling by the three-judge panel 8th US Circuit Court of Appeals put a stay on a lower court ruling that prevented officers from arresting, detaining, pepper-spraying or retaliating against protesters in Minneapolis without probable cause as anti-ICE agitators continue to confront authorities carrying out enforcement operations. "We accessed and viewed the same videos the district court did," the appeals court said in the ruling. "What they show is observers and protesters engaging in a wide range of conduct, some of it peaceful but much of it not. They also show federal agents responding in various ways." #Trump#ICE 👂More on Trump's Ear ⚠️
@SINLINEAMXnoticias · Post #31162 · 30.03.2026 г., 19:00
¡No más atropellos! 🤚🏻 🔴 14 mexicanos han muerto en lo que va del año bajo custodia del #ICE😔 | Estas son las acciones que implementará #Sheinbaum ante los abusos de la agencia migratoria 📄🔍 https://sinlineamx.com/sheinbaum-anuncia-nuevas-acciones-muerte-mexicanos-ice/
Hashtags
@wal_pep · Post #889 · 08.01.2026 г., 19:19
#Ice #Nature #4K
@SINLINEAMXnoticias · Post #31157 · 30.03.2026 г., 17:16
Se tomarán medidas ☝🏻 🔴#Sheinbaum anunció que su gobierno participará en una demanda presentada el 26 de enero en #EU mediante la figura de amicus curiae 📄 👉🏻 Además, denunció deficiencias en la atención médica del centro de detención del #ICE🤬
Hashtags
@wal_pep · Post #1074 · 09.02.2026 г., 22:35
#mixed #ice #4K
@trumpsear_tg · Post #2098 · 03.02.2026 г., 22:03
CBS News’s 60 Minutes did not spare President Donald Trump’s administration in its Sunday story about ICE shootings that was titled after questions posed by Sen. Rand Paul (R-KY): “Who can you kill and when can you kill them?” Paul asked the questions after the deaths of Renee Good and Alex Pretti as he announced he has scheduled a public hearing in Minneapolis later this month. Host Scott Pelley said Paul told him that he watched the video of Pretti being shot “again and again.” “I saw no evidence. I saw a man that was retreating,” Paul said. “I mean, he went to the middle of the street. He didn’t even obstruct traffic. He let a car go through. As the agents advanced on him, he retreated to the side of the street. A woman is violently pushed to the ground, and he turns to help her, and that’s when he is grabbed from behind. I saw no evidence of him assaulting the police.” When asked if Homeland Security Secretary Kristi Noem should be fired, Paul answered, “I think we have to get through our hearing February 12, and I think we have to see what the people who work for her say. But my advice to them, if they’re watching and they come to testify is, if you come in and you’re going to justify that this man was aggressively assaulting your police officers, that cannot be acceptable, and that’s why they’re lacking in trust.” Paul said that Noem, Border Patrol officer Greg Bovino, FBI Director Kash Patel, and White House advisor Stephen Miller used “terrible judgment” when they called the victims domestic terrorists and assassins. “I mean, terrible conclusions, incorrect conclusions, stating things that no one else believes. You can lie to your heart’s content if there’s no video, but the video doesn’t support what they’re saying,” Paul said. When Pelley asked, “You seem to be saying trust is broken?” Paul answered, “Without question.” #ICE#Media 👂More on Trump's Ear ⚠️
@trumpsear_tg · Post #2019 · 16.01.2026 г., 20:00
They are hired by ICE without filling out questionnaires, drug testing, or other mandatory checks. The famous progressive journalist Laura Jedeed tried to get a job at ICE and received a job offer without checking her documents and biography, writes (https://slate.com/news-and-politics/2026/01/ice-recruitment-minneapolis-shooting.html #) Slate. In August, she came to the ICE Career Fair in Texas out of professional interest. The interview lasted about six minutes. The recruiter asked questions about his age, military experience and desired place of service. The interview did not touch on other topics. #ICE#Media 👂More on Trump's Ear ⚠️
@voir_yeux · Post #11636 · 06.02.2026 г., 13:03
🇮🇹🇺🇸 Une manifestation contre la présence d'agents de l'ICE aux Jeux Olympiques s'est tenue à Milan, rapporte un correspondant de TASS. #italie#étatsunis#ice
Hashtags
@bestwallpapes · Post #3775 · 28.11.2025 г., 07:53
@Bestwallpapes #Mountain#Snow#Ice