TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

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

Пребарај: #tmail

当前筛选 #tmail清除筛选
TONlines – News

@tonlines · Post #7709 · 04.12.2025 г., 14:01

TON — LIVE: Launch of TMAIL on TON Blockchain #TON#TMAIL TON — LIVE has announced the launch of TMAIL, a private mail service on the TON blockchain. Users can mint a unique address as an NFT, linked to their wallet, for sending and receiving emails. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7693 · 03.12.2025 г., 13:22

Русский TON: Tmail Launches as Secure Blockchain Email #Tmail#blockchain Русский TON highlights the launch of Tmail, a blockchain-based private email service that replaces traditional passwords with NFT-based addresses. This innovative project aims to provide a secure emailing experience by linking accounts to blockchain wallets. Tmail also offers a giveaway of 50,000 GRAM tokens. Source: link @tonlines

Telegram & TON NEWS

@all_telegram_ton_news · Post #23029 · 12.02.2026 г., 01:33

📬Tmail — I’ve been using it daily since beta. Honest review from someone who’s lived in this inbox for 6 months straight Hey crypto family! 👋 Email was the same for 50 years: centralized, scanned, full of spam, passwords, captchas. We waited years for real Web3 email… and it’s finally here. And it’s already BETTER than Gmail. Seriously. I’ve been in since closed beta (May 2025) → now I own 27 addresses. Main one: [email protected]📱 Here’s why it’s already the best email I’ve ever used: 🔥Address Gmail → [email protected] Tmail → [email protected] (you own it forever. Web3 mail) + [email protected] (works everywhere web2 mail, including Telegram 2FA) 🔥Privacy Gmail → scanned & sold Tmail → E2E encryption + IPFS/TON Storage. Even the Tmail team can’t read your emails 🔥Spam Gmail → pure hell Tmail → smart filter + bulk unsubscribe in one click 🔥Attachments Gmail → basic Tmail → photo/video preview right in the email 🔥Multiple accounts Gmail → pain and suffering Tmail → 100+ addresses, switch in 1 click, pin 10 favorites (Premium) 🔥Speed Gmail → okay Tmail v1.5 → emails & attachments load instantly 🔥Extras Gmail → ads Tmail → AI assistant (Premium), contacts, subscription manager 🔥Login Gmail → password + endless 2FA Tmail → just connect TON wallet. Done. Works perfectly in Telegram Mini App (@TheTmail) and on web app.tmail.ae I get Telegram codes, bank confirmations, exchange mails — everything arrives instantly. Zero captchas. The NFT now pays for itself, 📬Tmarket is a money printer, floor is climbing, big marketing hasn’t even started yet. → 0–1% fees on Tmarket (instead of 5%) → 50% of platform profit from your referrals → +10% instant when someone mints via your link → Rarity ranks live → $TMAIL token airdrop coming (shorter = bigger bag) → Floor already climbing hard, many names 5–20x Tmarket.icu is a cheat code: Premium, Stars, Steam, eSIM, TON top-ups → cheapest anywhere + passive income. TON going 300M+ users soon. When normies wake up → good names = gone, floor = 4-figures. I’m not selling any of mine. Grab your name before the masses wake up →📬Tmarket or on https://getgems.io/tmail (Pro tip: mint a few short ones now, thank me in 2026 ) See you in the inbox legends 💎 @DanishCryptoDK [email protected] 📬 #Tmail#TON#Web3#NFT#Email#Crypto#Telegram#Tmarket#TheOpenNetwork

Telegram & TON NEWS

@all_telegram_ton_news · Post #22453 · 20.12.2025 г., 02:14

📬Tmail — I’ve been using it daily since beta. Honest review from someone who’s lived in this inbox for 6 months straight Hey crypto family! 👋 Email was the same for 50 years: centralized, scanned, full of spam, passwords, captchas. We waited years for real Web3 email… and it’s finally here. And it’s already BETTER than Gmail. Seriously. I’ve been in since closed beta (May 2025) → now I own 27 addresses. Main one: [email protected]📱 Here’s why it’s already the best email I’ve ever used: 🔥Address Gmail → [email protected] Tmail → [email protected] (you own it forever. Web3 mail) + [email protected] (works everywhere web2 mail, including Telegram 2FA) 🔥Privacy Gmail → scanned & sold Tmail → E2E encryption + IPFS/TON Storage. Even the Tmail team can’t read your emails 🔥Spam Gmail → pure hell Tmail → smart filter + bulk unsubscribe in one click 🔥Attachments Gmail → basic Tmail → photo/video preview right in the email 🔥Multiple accounts Gmail → pain and suffering Tmail → 100+ addresses, switch in 1 click, pin 10 favorites (Premium) 🔥Speed Gmail → okay Tmail v1.5 → emails & attachments load instantly 🔥Extras Gmail → ads Tmail → AI assistant (Premium), contacts, subscription manager 🔥Login Gmail → password + endless 2FA Tmail → just connect TON wallet. Done. Works perfectly in Telegram Mini App (@TheTmail) and on web app.tmail.ae I get Telegram codes, bank confirmations, exchange mails — everything arrives instantly. Zero captchas. The NFT now pays for itself, 📬Tmarket is a money printer, floor is climbing, big marketing hasn’t even started yet. → 0–1% fees on Tmarket (instead of 5%) → 50% of platform profit from your referrals → +10% instant when someone mints via your link → Rarity ranks live → $TMAIL token airdrop coming (shorter = bigger bag) → Floor already climbing hard, many names 5–20x Tmarket.icu is a cheat code: Premium, Stars, Steam, eSIM, TON top-ups → cheapest anywhere + passive income. TON going 300M+ users soon. When normies wake up → good names = gone, floor = 4-figures. I’m not selling any of mine. Grab your name before the masses wake up →📬Tmarket or on https://getgems.io/tmail (Pro tip: mint a few short ones now, thank me in 2026 ) See you in the inbox legends 💎 @DanishCryptoDK [email protected] 📬 #Tmail#TON#Web3#NFT#Email#Crypto#Telegram#Tmarket#TheOpenNetwork

Telegram & TON NEWS

@all_telegram_ton_news · Post #22603 · 05.01.2026 г., 18:35

‌Tmail Community 💌 (Telegram) 🎉 Winners of New Year Giveaway The auction has been successfully completed🔥 Thank you to everyone who participated in our event! Here's the list of our lucky winners: 🏆Grand Prize Winner: 500 $TON + Special NFT: UQAv2olsFSZHrd5QE8_e0uqSVERmSuCULa6QYjfJwnGb6Lfv 🎁 Random Winners: Each received 5 TON 1️⃣UQCn0uTEIFZUp7YOHSum0XKNvcWNdCBVyfmyKSRxoPNT-s3T 2️⃣UQDXec16Kj543emSld1fCStGQyvUgFrMDtr1ie7ghTJej8up 3️⃣UQCNfpcXEmnRGas0VeAUM18x8kgfaUWJHytSY1DWqf4mDXUn 4️⃣UQAJFrSqc06qYeqwFkhSYC4THJoA-NczIvAoWtAxuxJDpuOr 5️⃣UQD0NeGGvR_xZ4EhKJllPSoPY9cbfmj-iaePSvgNd5M0XTUe 6️⃣UQAYMvWB_Z45bkrcqgRWAnC3mv15p08ySi0nM-Q8k5Afa3F7 7️⃣UQDvRTLLBL2td20Gq6Cjj6O-K8r4a0fuU-hI2fQHYPX_Ir4E 8️⃣UQBu3mfft-VlV6O9gicr3GyqXq0BI_X3MRps154BDwZxs9cv 9️⃣UQDwreWMrQqNyyhB6k-EGHCAhhmmZ91PtQI0YZkf-jI4r1MC 1️⃣0️⃣UQBnA0Ei03fW6zrqO6nswdQgY8BwgufVwAXbT40VoTQ1zttT Congratulations to all the winners 🎊 If you didn’t win this time, don’t worry — more exciting events and surprises are coming soon ❤️ Miniapp | Webapp #NewYear#tmail#ton#nft#dns#email#mail#web3#Giveaway

Telegram & TON NEWS

@all_telegram_ton_news · Post #23279 · 28.02.2026 г., 11:58

🚀Degen Privacy Stack 2026: Own Your Comms with No-KYC Crypto Tools – From eSIMs to Encrypted Chats! here's the ultimate blueprint for true digital sovereignty – all powered by crypto, privacy keys, and zero KYC hassles. Stay ghosted in a surveillance world: - Degenphone eSIM Mastery: Tokenize real eSIM phone numbers as NFTs on Solana/TON. Own a working number for SMS, calls, and data plans – mint, trade, activate anonymously via blockchain. No ID, no docs – just your wallet and privacy keys for instant, traceless global connectivity. - tMail for Ephemeral Emails: Grab disposable, auto-expiring emails without KYC. Crypto payments optional for premium anonymity – link to your setups for secure logins that vanish post-use, keeping your real identity locked away. - Nostr Protocol Freedom: Decentralized social with pub/priv keys – no email/phone signup, pure P2P relays. Zap sats via Lightning, build uncensorable networks. Own your data, migrate keys seamlessly for ultimate control. - SimpleX Chat Supreme: E2EE messenger with no user IDs – connect via QR/one-time links. Amp up with white noise vector sessions: Inject random noise into traffic for anti-analysis, quantum-resistant encryption, and self-destructing messages. - Vector Messenger Edge: Nostr-based, zero-metadata encryption for texts, media, voice. BIP-39 wallet integration turns your account into a crypto vault – plausible deniability and no-compromise privacy. - White Noise App Stealth: Nostr-powered secure messenger with MLS end-to-end encryption. Forward/post-compromise security, identity-free – massive scalable groups without leaks. - 0xChat Lightning Vibes: Nostr secure chat with private key login – no reg, E2EE DMs/groups, voice/video, Cashu/Lightning payments. Encrypted everything, alias keys for extra secrecy. - Video Calls on Honey HiveTalk: Nostr-first conferencing at https://honey.hivetalk.org – Lightning-powered rooms, desktop-optimized for private group calls. Zap to join/active, no KYC barriers. Stack these for crypto trades, activism, or pure freedom – own your phone, email, chats with crypto keys only. No Big Tech oversight! #DegenPrivacy#NoKYC#CryptoSovereignty#Nostr#SimpleX#VectorMessenger#WhiteNoiseApp#0xChat#Degenphone#tMail#HiveTalk#PrivacyTools2026 Your fave stack addition? Zap or reply! 🔒👻