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

Резултати

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

Пребарај: #xlm

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

@proanalysistrader · Post #28537 · 13.03.2025 г., 03:30

#XLM/USDT analysis : #XLM is in an uptrend, trading above the 200-day EMA on the daily timeframe. The price has tested the support zone and 200-day EMA, and it is expected to rebound from the current level and move upside to test higher levels. For a long entry, wait for the price to break above the $0.2760 level. TF : 1D Entry : $0.2764 Target : $0.6374 SL : $0.2094

Hashtags

Pro Analysis

@proanalysistrader · Post #28490 · 21.02.2025 г., 15:22

#XLM/USDT analysis : #XLM is in an uptrend, forming higher highs (HHs) and higher lows (HLs) above the 200 EMA. The price has retested the 200 EMA and is anticipated to rebound, resuming its bullish momentum to test swing high levels. For a long entry, it is recommended to wait for a breakout above the $0.3751 level. TF : 1D Entry : $0.3751 Target : $0.6374 SL : $0.2764

Hashtags

Pro Analysis

@proanalysistrader · Post #27761 · 17.07.2024 г., 17:09

#XLM/USDT analysis - #XLM recently broke above the 200 EMA with strong momentum. The next move might be a retest of this level and a test of the support zone. Look for a pullback near the 200 EMA for a potential long entry. The previous resistance zone could serve as the target level. TF : 4h Entry : $0.0937 Target : $0.1198 SL : $0.0863

Hashtags

American Crypto©

@americancryptotrading · Post #27579 · 05.04.2026 г., 09:35

🇺🇸#XLM/USDT is currently forming the descendingchannel formation on the 3D timeframe🔍 Accumulate before the rocket takes off✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27489 · 02.01.2026 г., 10:30

🇺🇸#XLM/USDT is trading inside the descendingchannel on the 2D chart👨‍💻 Bullish on a breakout🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27390 · 28.09.2025 г., 08:30

🇺🇸#XLM/USDT is holding above the broken s/rzone on the daily chart🔥 Bullish📈 American Crypto©

Hashtags

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