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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #65 · 8 апр.

Небольшой трик с регулярными выражениями который редко вижу в чужом коде. Допустим, вам нужно распарсить простой текст и вытащить оттуда пары имя+телефон. Вернуть всё это надо в виде списка словарей. Возьмем очень простой пример текста. >>> text = ''' >>> Alex:8999123456 >>> Mike:+799987654 >>> Oleg:+344456789 >>> ''' Соответственно, для выделения нужных элементов будем использовать группы. Получится такой паттерн: (\w+):([\d+]+) Как мы будем формировать словарь из найденных групп? >>> import re >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append({ >>> "name": match.group(1), >>> "phone": match.group(2) >>> }) >>> print(results) [{'name': 'Alex', 'phone': '8999123456'}, ...] Можно немного сократить запись используя zip >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append(dict(zip(['name', 'phone'], match.groups()))) Но есть способ лучше! Это именованные группы в regex. Можно в паттерне указать имя группы и результат сразу забрать в виде словаря. >>> for match in re.finditer(r"(?P<name>\w+):(?P<phone>[\d+]+)", text): >>> results.append(match.groupdict()) То есть всё что я сделал, это добавил в начале группы (внутри сбокочек) такую запись: (?P<group-name>...) Теперь найденная группа имеет имя и можно обратиться к ней как к элементу списка >>> name = match['name'] Либо забрать сразу весь словарь методом groupdict() >>> match.groupdict() #tricks#regex

Резултати

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

Пребарај: #sfdp

当前筛选 #sfdp清除筛选
GitHub Trends

@githubtrending · Post #15341 · 18.12.2025 г., 11:30

#c_lang#driver#flash#jedec#jedec_sfdp#qspi#sfdp#sfdp_flash#spi_flash#universal_driver **SFUD** is an open-source library that drives many SPI/QSPI Flash chips from brands like Winbond and Macronix. It auto-detects chip specs via the **SFDP** standard or a built-in table, letting you read, write, erase, and init with simple APIs after easy config. This helps you avoid risks from Flash shortages or upgrades, boosts software reuse across projects, cuts dev time, and enables tools like programmers—saving effort on varied hardware. https://github.com/armink/SFUD

Crypto M - Crypto News

@CryptoM · Post #65441 · 13.04.2026 г., 08:34

🚀 Japanese Game Company WIZE Expands Solana Holdings Japanese game company WIZE, formerly known as Mobcast Holdings, has announced that its cumulative purchase of SOL has reached approximately $3.13 million (500 million yen) as of April 10, 2026. According to Foresight News, the company currently holds over 24,597 SOL, with an average purchase price of around $127 (20,327 yen) per SOL, ranking 15th globally on CoinGecko's 'Solana Treasury Holdings' list. Over the past six months, WIZE has earned more than 400 SOL in staking rewards. The company's 'WIZE Validator Node' has officially joined the Solana Foundation's SFDP program and has received delegations from projects like DoubleZero. Including external delegations, WIZE's total treasury amounts to approximately 152,000 SOL. The company aims to further increase its holdings to enter the top 10 globally as soon as possible. #JapaneseGameCompany#WIZE#Solana#SOL#ForesightNews#SolanaTreasuryHoldings#StakingRewards#WIZEValidatorNode#SFDP#DoubleZero#Crypto#Blockchain#Cryptocurrency#GameIndustry