@cursosgratismega · Post #798 · 08.06.2022 г., 22:07
Problemas de arranque | #Users
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
Пребарај: #users
@cursosgratismega · Post #798 · 08.06.2022 г., 22:07
Problemas de arranque | #Users
Hashtags
@cursosgratismega · Post #772 · 22.05.2022 г., 16:17
Programación desde cero | #Users
Hashtags
@cursosgratismega · Post #675 · 03.02.2022 г., 14:05
Administrador de Redes Windows | #Users
Hashtags
@native_fi · Post #114 · 05.09.2025 г., 04:42
#Users who's withdrawals are stuck on Pending Steps to complete it are DM : @gBuidl or Mail : [email protected] Share your UID, amount and token withdrawn and the tx hash to the support chat Once your withdrawal is successfully processed you'll receive an update from our support team under your ticket about your successful withdrawal Rest assured your funds are safe, and these reviews have been places to ensure the safety of your funds. Thank you for your patience while we process the high withdrawal requests received from over night
Hashtags
@NEWS_AND_TIPS · Post #2600 · 22.07.2024 г., 17:27
Telegram reached 950 million monthly users (900 Million) Source : 💌💌💌 & 💌💌💌 #950million#Users#Telegram
Hashtags
@SpEcHlDe · Post #947 · 05.01.2020 г., 13:54
#telegram#bots#users#edit#delete#restriction#limits
@venturevillagewall · Post #3826 · 09.01.2025 г., 04:00
Binance Hits 250M Users, Record Stats Binance reports over 250 million registered users by year's end, a 47% increase. Platform processed 4.44M requests/second; VIP users up 116%, institutional users up 97%. Internal compliance team expanded to 650 experts. Read more US government clear to liquidate 69,000 Bitcoins (valued at $6.5B) seized from Silk Road. This follows a promise by the new administration not to sell the Bitcoins. Read more #Binance#Bitcoin#Crypto#Users#VIP#Institutional#Compliance#SilkRoad#Seizure#Finance#USGovernment#AnnualReport#MarketCap#Trading#Blockchain#Investments#Tech#DigitalCurrency#News
@venturevillagewall · Post #3745 · 29.12.2024 г., 16:00
Blum's Controversial Update Sparks Backlash Blum's recent announcement regarding its new point system has raised eyebrows among users, seen as devaluing months of effort. Critics argue that this move reflects a greed-driven strategy rather than rewarding loyal users. The absence of referral incentives further fuels dissatisfaction, with many questioning Blum's leadership approach. Some believe that this misstep may jeopardize future user trust if the token drop lacks transparency and fairness. For more details, read the full analysis here: TonUP_SRP and check the discussed token drop implications: Bybit. #Blum#Crypto#VC#TokenDrop#Loyalty#Referral#Sustainability#Users#Growth#Feedback#Strategy#Leadership#Earnings#Finance#Investing#WhaleAlert#BTC
@venturevillagewall · Post #3402 · 18.12.2024 г., 12:10
Dfns Secures $16M Funding Dfns, the wallet-as-a-service (WaaS) platform, has raised $16 million in funding as of December 18, 2024. The platform is designed to simplify digital asset operations and facilitate safe crypto onboarding for leading organizations. #Dfns#Funding#WaaS#DigitalAssets#Crypto#Operations#Onboarding#Investment#Security#Technology#Finance#Blockchain#Startups#Innovation#Market#Users#Ecosystem#Wallet#Services#Platform#Growth
@venturevillagewall · Post #3987 · 26.01.2025 г., 04:00
Coinbase Considers New Listing Strategy Brian Armstrong mentions that Coinbase is exploring a shift to a democratized listing style, favoring a 'block list' approach over an 'allow list'. Additionally, as of November 2024, Indonesia reports 22.1 million registered cryptocurrency users, with USDT, BTC, DOGE, PEPE, and XRP being the most traded. More details can be found in the report by Wu Blockchain here. #Coinbase#Crypto#Indonesia#USDT#BTC#DOGE#PEPE#XRP#Blockchain#MarketData#Trading#Users#Statistics#Listing#Democratized#Finance#Trends #2024 #Innovation#VC#AI
@botsgram_cu · Post #3169 · 25.11.2020 г., 16:40
@channely_bot Qué puede hacer este bot? Este bot es el mejor asistente para la gestión de canales en Telegram. Conecto los canales al servicio principal. ¡Incluyendo un rico entorno webUI de edición! https://app.channely.co/ Idioma: Inglés (visto en @BotsGram.cu) #canales, #canal, #gestión, # administración, #richeditor, #posts, #schedule, #polls, #comment, #commenting, #reactions, #editor, #share, #buttons, #webui, #subscribe, #stats, #users, #trial, #limited, #proaccount
@venturevillagewall · Post #3590 · 20.12.2024 г., 12:23
Google's Growth Dilemma Revealed Google faces a challenge with 5.5 billion users searching three times daily, leading to a near 98% penetration of its services. The company's pressure to show growth for investors may have led to risky strategies, including diversifying user journeys to boost commercial queries. A leaked document outlines these changes aimed at enhancing growth beyond organic metrics. Find out more in our podcast: Кухня. 📈 Listen here: Кухня Podcast For the full leaked document: Leaked Document #Google#Search#Users#Growth#Investment#Penetration#CommercialQueries#Tech#Strategy#Marketing#DocumentLeak#Podcast#DigitalMarketing#UserJourney#Innovation#Business#Alphabet#TechCulture#Earnings#MarketTrends