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

Резултати

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

Пребарај: #tapswapcodes

当前筛选 #tapswapcodes清除筛选
Airdrop Center

@centralchanel · Post #16336 · 29.01.2025 г., 18:36

📢TapSwap Codes 29 Jan ✅$4,000/Month On Amazon ☑️ 4war ✅ Want Financial Freedom ☑️ vuaw ✅Want to Get Rich? ☑️ wnob ✅Airbnb For Beginners ☑️ ivsv ✅The Latest TapSwap ☑️ rnxe ✅Drive Your Way ☑️ kasd ✅Earn Over $4,000 Monthly ☑️ rocr ✅Avoid Financial Struggles ☑️ vu3d #tapswapcodes#TapSwapCode#TapSwap

Airdrop Center

@centralchanel · Post #16237 · 23.01.2025 г., 19:24

Tapswap All Codes 23 Jan🗓️ 1️⃣ - Top Brands in 2025 ✅ - afdf 2️⃣ - Earn Free Bitcoin ✅ - a7a2 3️⃣ - Make Your Dreams a Reality ✅ - tenp 4️⃣ - Instagram Into a $100/Day ✅ - exxr 5️⃣ - 5,000$ in 30 Days ✅ - aact 6️⃣ - Unlock Free Products ✅ - fifa 7️⃣ - Online Business in 2025 ✅ - rmap 8️⃣ - Want to Achieve It All ✅ - qxun #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #16199 · 21.01.2025 г., 20:14

Tapswap All Codes 21 Jan🗓️ 1️⃣ - Earn $100 Every Day ✅ - ouns 2️⃣ - Turn X Into a $5,000/Month ✅ - astv 3️⃣ - Opening an Online Business ✅ - rzr2 4️⃣ - Make Money on Binance ✅ - ema9 5️⃣ - Make 2025 Your Year ✅ - d5n5 6️⃣ - Free Gifts from Loyalty Programs ✅ - v2q3 7️⃣ - Making Money with Free Online ✅ - occl 8️⃣ - You Desire in Life ✅ - cdae #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #16130 · 18.01.2025 г., 20:42

Tapswap All Codes 18 Jan🗓️ 1️⃣ - Unlock Free Rewards ✅ - rm8b 2️⃣ - Get Free Online Courses ✅ - kpsl 3️⃣ - Make Money Without Leaving ✅ - orrm 4️⃣ - Monetizing Your Content ✅ - nfgv 5️⃣ - Earning $1,000 in Crypto ✅ - mga7 6️⃣ - Earn 10k on TikTok ✅ - e53e 7️⃣ - Flip and Earn ✅ - h3xr 8️⃣ - Earn $100+ Daily ✅ - kd5r #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #16024 · 13.01.2025 г., 19:18

Tapswap All Codes 13 Jan🗓️ 1️⃣ - Low-Cost Franchises ✅ - tfgk 2️⃣ - AI Dropshipping ✅ - is1p 3️⃣ - Life Lessons I Learned ✅ - qrze 4️⃣ - Craft an Online Portfolio ✅ - eq4d 5️⃣ - Build a Website Easily ✅ - ct39 6️⃣ - Financial Goals ✅ - s3vr 7️⃣ - Save More with Less ✅ - tf8m 8️⃣ - Maximize Your Time ✅ - w25gc #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #15958 · 10.01.2025 г., 20:48

Tapswap All Codes 10 Jan🗓️ 1️⃣ - Minimalist Principles ✅ - v4ek 2️⃣ - Must-Have AI Apps ✅ - wiy6n 3️⃣ - Maximize Your Small Business ✅ - rz9t 4️⃣ - Crack the Code ✅ - uf5c 5️⃣ - Passive Income ✅ - ask1 6️⃣ - LinkedIn Success ✅ - e33y 7️⃣ - Outsource Without Breaking the Bank ✅ - h3rk 8️⃣ - Google Search Hacks ✅ - bent #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #15775 · 02.01.2025 г., 19:29

Tapswap All Codes 2 Jan🗓️ 1️⃣ - Profitable Gift Business ✅ - a7ds 2️⃣ - Pretending to Be a Paparazzi ✅ - b6ta 3️⃣ - From Scratch to Success ✅ - d46k 4️⃣ - Billionaire Negotiation Tactics ✅ - g3ov 5️⃣ - From Vintage to Valuable ✅ - nm4t 6️⃣ - Unstoppable Business Team ✅ - ea2r 7️⃣ - Shopify Dropshipping ✅ - sc9h 8️⃣ - Old Furniture Into Cash ✅ - ah46 👉https://t.me/tapswap_mirror_1_bot?start=r_452308012 #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #15645 · 26.12.2024 г., 20:40

#TAPSWAP CODES 26 DECEMBER ☑️Get Paid to Solve Problems ✅m3sr ☑️High CPM YouTube Niches ✅4wn5 ☑️Turn Your Knowledge ✅5uvn ☑️Best Affordable Franchises ✅m9sq ☑️Dropshipping with AI ✅kr32 ☑️Knew Before Turning 30 ✅fv3e ☑️Online Portfolio ✅b5ah ☑️Small Business ✅ofv3 #tapswap#tapswapcode#tapswapcodes

Airdrop Center

@centralchanel · Post #15731 · 30.12.2024 г., 20:54

TapSwap Video Codes 🎥 30 December 2024 🗓️ 1. Master LinkedIn - 5mre 2. Save Time and Money - dw61 3. Searches Into $500/Day - j4qd 4. Student Side Hustles - a2p1 5. Travel on a Budget - 8exa 6. Google Books - 4osq 7. Winning Dropshipping Products - p7oc 8. Marketing Plan - s2rt 9. Automate Your Day - wb52 10. Financial Freedom - nu4d 11. Financial Milestones - o6ma 12. Website from Scratch - sweb #tapswapdaily#tapswapcodes

Airdrop Center

@centralchanel · Post #16005 · 12.01.2025 г., 19:46

#Tapswap Cinema Codes 12 January 🗓️ 🧵If need yesterday's code check link below 👇👇 1️⃣ - Task: From Beginner To Expert ✅ - Code: 4bvr 2️⃣ - Task: Tips for New Entrepreneurs ✅ - Code: adtn 3️⃣ - Task: Create and Monetize ✅ - Code: ncns 4️⃣ - Task: Profitable Clothing Line ✅ - Code: is8n 5️⃣ - Task: Leverage LinkedIn ✅ - Code: rt49 6️⃣ - Task: Google Books and AI Combined ✅ - Code: hnsu 7️⃣ - Task: Trending Products ✅ - Code: 8zts 8️⃣ - Task: Marketing Plan for Your Business ✅ - Code: e2yt #TapSwap#TapSwapDaily#tapswapcodes

Airdrop Center

@centralchanel · Post #15619 · 25.12.2024 г., 20:02

TapSwap Video Codes 🎥 25 December 2024 🗓️ 1. Walk Away from Your 9-to-5 Job - kzgs 2. Master the Art of Business Planning - itgi 3. TikTok Shop Dropshipping - ahue 4. Productivity Hacks - mfpi 5. Financial Traps - hmsy 6. Save Money - r4iw 7. Business Ideas - 7sg9 8. Save Time and Money - k77e 9. Google Search - es8m https://t.me/tapswap_mirror_1_bot?start=r_452308012 #TapSwap#tapswapcodes#tapswapdailycodes

Airdrop Center

@centralchanel · Post #16597 · 18.02.2025 г., 10:16

✅Value Airdrop Center Family Daily Combo Answers Are Written Below According to Photo Order, Please do it by proceeding.👇18/02/2025 📢 MemesLab Bums Tapcoins Donot StarsFi Dropee Pocketrocket DrftParty GreenGold Beeharvest Piggybank Flies You can find more Airdrops from the link. 👉https://t.me/CentralChanel/12301 #DailyCombo#Seed#TGE#Airdrop#Ton#Code#Quiz#Daily#Youtube#Blum#TapswapCodes#MemeFi#Telegram@Airdroptrex

123•••10•••20•••2425
ПретходнаСтраница 1 од 25Следна