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

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #146 · 16 сеп.

Функция sub в regex может принимать функцию в качестве аргумента repl. 📄 Из документации: If repl is a function, it is called for every non-overlapping occurrence of pattern. The function takes a single match object argument, and returns the replacement string. То есть для каждого совпадения будет вызвана функция для вычисления замены вместо замены на одну и ту же строку для всех совпадений. Иными словами, для замены разных совпадений на разные строки не потребуется запускать re.sub() много раз для каждой строки замены. Достаточно определить функцию, которая вернёт строку для каждого из совпадений. Описание слишком запутанное🤔, давайте лучше рассмотрим на простом примере: Создаем карту замены. То есть какие строки на какие требуется менять. remap = { 'раз': '1', 'два': '2', 'три': '3', 'четыре': '4', 'пять': '5', } Пишем функцию поиска строки для замены. Единственным аргументом будет объект re.Match. Используя данные этого объекта мы вычисляем замену on-the-fly! def get_str(match: re.Match): word = match.group(1) return remap.get(word.lower()) or word Пример текста. text = '''Раз Два Три Четыре Пять Вместе будем мы считать Пять Четыре Три Два Раз Мы считать научим вас ''' Теперь запускаем re.sub и вместо строки замены (repl) подаём имя функции. (Данный паттерн ищет отдельные слова в тексте) >>> print(re.sub(r'(\w+)', get_str, text)) 1 2 3 4 5 Вместе будем мы считать 5 4 3 2 1 Мы считать научим вас Думаю, достаточно наглядно 🤓 #libs#regex

Hashtags

Резултати

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

Пребарај: #bliss

当前筛选 #bliss清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #596 · 21.04.2025 г., 11:13

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.5 - Codename: #Pong - Released: 21/4/25 🔽Download:Vanilla | Vanilla(Mirror) (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ ChangelogsROM | Device ✍️ Note: - Vanilla only - clean flash recommended - you can use this gapps: here, or flash your choice of gapps/microg if you know what you're doing - ksu disabled bcs of official requirements 🏆 Credits - @Ghosuto7 for DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #567 · 25.02.2025 г., 13:35

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.3 - Codename: #Pong - Released: 25/2/25 🔽Download:Vanilla | Gapps (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs Rebase tree so clean flash is necessary ✍️ Note: - Both Gapps and Vanilla build available - ksu disabled bcs of official requirements, for kernel with ksu flash this 🏆 Credits - @Ghosuto7 for DT - Hellboy forMeteoric kernel - Fabian & Hellboy for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #539 · 29.01.2025 г., 17:05

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.2 - Codename: #Pong - Released: 29/1/25 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - Update to NOS V3.0-250113-1723 firmware - Improvements to system performance and stability ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers - Note: bliss is not patched with ksu due to official requirements 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #494 · 21.12.2024 г., 10:21

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.1 - Codename: #Pong - Released: 19/12/24 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - Switch to armv9-a and kryo300 CPU variants - Improvements to system performance and stability ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #476 · 24.11.2024 г., 07:09

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.0 - Codename: #Pong - Released: 24/11/24 🔽 Download: [ Vanilla | Gapps ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ Changelogs - initial A15 official build - Pre rooted allowed in official builds, flash the ksu version youself ✍️ Note: - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian & Hellboy for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #406 · 23.08.2024 г., 07:20

Bliss - Unofficial | Android 14 | Nothing Phone (2) ✍️ Details: - Version: 17.7 - Codename: #Pong - Released: 23/08/24 🔽 Download: [ GDrive ] (Sideload Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Bliss#QPR3#U ✨ Changelogs - initial build ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps already included 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #471 · 11.11.2024 г., 06:47

Bliss - Unofficial | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.0 - Codename: #Pong - Released: 11/11/24 🔽 Download: [ Link ] (Recovery Build) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Community#Bliss#V ✨ Changelogs - initial A15 build ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy forMeteoric kernel - Fabian and Hellboy for PA Glyph Implementation 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #442 · 24.09.2024 г., 07:54

Bliss - Unofficial | Android 14 | Nothing Phone (2) ✍️ Details: - Version: 17.8 - Codename: #Pong - Released: 24/09/24 🔽 Download: [ Link ] (Recovery Build - flash with ofox) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#QPR3#U ✨ Changelogs - Add device extras - switch to user build - Add Charging Control - Add dolby support - Improvements to performance and system stability ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - Both Gapps and Vanilla build available 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #626 · 05.06.2025 г., 14:26

Bliss - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 18.6 - Codename: #Pong - Released: 02/06/2025 - Type: #Vanilla 🔽Download:Here | Mirror | Gapps 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here 🔖 Tags : #ROM#AOSP#Official#Bliss#V ✨ ChangelogsROM | Device ✍️ Note: - Clean flash recommended - KSU disabled bcs of official requirements 🏆 Credits - @Ghosuto7 for DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers 👤 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2