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

Резултати

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

Пребарај: #fet

当前筛选 #fet清除筛选
Pro Analysis

@proanalysistrader · Post #28270 · 27.11.2024 г., 07:56

#FET/USDT Analysis- The price has formed a symmetrical triangle pattern. Given the current bullish market scenario, there is a high probability of an upward breakout. If the breakout occurs, the price is likely to rally toward the target zone from the breakout point. T.F.- 1-D ENTRY- as soon as it gives breakout SL- 1.2 TARGET- 2.04 Note: If the stop-loss is triggered before entry, disregard the trade as the price action may develop differently.

Hashtags

Pro Analysis

@proanalysistrader · Post #27893 · 31.08.2024 г., 17:52

#FET/USDT analysis : #FET has broken down the 200 EMA and previous support levels. It is now undergoing a pullback and retesting the resistance zone. The price is expected to reject from there and bounce back to continue its bearish momentum. TF : 1H Entry : $1.170 Target : $1.057 SL : $1.252

Hashtags

American Crypto©

@americancryptotrading · Post #27518 · 29.01.2026 г., 11:04

🇺🇸#FET/USDT is facing the lowerboundary of the descendingchannel formation on the weekly chart🧐 Looks bullish✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27482 · 27.12.2025 г., 09:39

🇺🇸#FET/USDT is trading near the lowerborder of the descendingchannel formation on the 2W chart💁‍♂️ A great moment to accumulate🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27370 · 10.09.2025 г., 09:48

🇺🇸#FET/USDT is trading within the descending channel formation on the 3D chart🧐 More upside if a breakout occurs📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27280 · 14.06.2025 г., 12:10

🇺🇸#FET/USDT is hovering above the broken s/rzone on the weekly chart🔍 Looking for a bounce✈️ American Crypto©

Hashtags

123•••56
ПретходнаСтраница 1 од 6Следна