@ChrisBrownfans2020 · Post #3562 · 15.06.2025 г., 18:17
📈#ChrisBrown’s “Holy Blindfold” becomes one of his biggest streaming debuts. It received 1,274,313 streams in its accumulative day of tracking on Spotify.
Hashtags
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
Пребарај: #chrisbrown
@ChrisBrownfans2020 · Post #3562 · 15.06.2025 г., 18:17
📈#ChrisBrown’s “Holy Blindfold” becomes one of his biggest streaming debuts. It received 1,274,313 streams in its accumulative day of tracking on Spotify.
Hashtags
@ChrisBrownfans2020 · Post #3409 · 26.10.2024 г., 22:34
📈#ChrisBrown’s “Residuals” has now surpassed 40 Million Spotify streams! @chrisbrown where’s the music video? 🤔
Hashtags
@ChrisBrownfans2020 · Post #3391 · 07.10.2024 г., 15:12
📈#ChrisBrown’s “Residuals” has moved up to #60 on Billboard Radio Songs charts.
Hashtags
@ChrisBrownfans2020 · Post #3326 · 22.07.2024 г., 23:29
📈#ChrisBrown’s ‘11:11’ has just reached 700 Million Spotify streams 🎉
Hashtags
@ChrisBrownfans2020 · Post #3241 · 09.06.2024 г., 03:44
5 years ago today, Chris Brown released “No Guidance” featuring Drake #ChrisBrown
Hashtags
@ChrisBrownfans2020 · Post #3206 · 14.05.2024 г., 14:33
📈#ChrisBrown’s ‘11:11’ tour ticks off next month. What song would you like to be the opener? ⬇️
Hashtags
@ChrisBrownfans2020 · Post #3203 · 13.05.2024 г., 03:46
📈#ChrisBrown’s ‘Delusional’ and ‘Residuals’ have both now surpassed 5 Million streams on Spotify.
Hashtags
@ChrisBrownfans2020 · Post #3131 · 05.03.2024 г., 05:34
📈🚨#ChrisBrown’s ‘11:11 Tour’ is upon us!! Billboards are being placed across multiple Arenas in USA displaying 11:11
Hashtags
@ChrisBrownfans2020 · Post #3099 · 27.01.2024 г., 23:14
#ChrisBrown’s ‘Angel Numbers / Ten Toes’ has surpassed 70 Million streams on Spotify.
Hashtags
@ChrisBrownfans2020 · Post #3086 · 09.01.2024 г., 23:53
#ChrisBrown’s ‘Angel Numbers / Ten Toes’ has reached 50 Million Spotify streams 🎉
Hashtags
@ChrisBrownfans2020 · Post #3059 · 13.12.2023 г., 02:15
🚨Kanye West and Ty Dolla Sign will release their album ‘Vultures’ this Friday. #ChrisBrown on Track 5.
Hashtags
@ChrisBrownfans2020 · Post #3543 · 27.03.2025 г., 14:05
🚨 Chris Brown just announced his Stadium World Tour, "Breezy Bowl XX," in celebration of his 20th career anniversary. The tour will take place in Europe and North America, featuring special guests Summer Walker and Bryson Tiller. #Chrisbrown#breezybowl
Hashtags