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

Резултати

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

Пребарај: #ethfi

当前筛选 #ethfi清除筛选
Coin Sonar

@CoinSonar · Post #243772 · 17.04.2026 г., 16:38

#ETHFI | Volume spike (USDT PAIR) 9 times the average volume 409.56K USDT traded in 15 min └Buying vol: 221.69K USDT 🟢 Boost score: 5/10 24h Vol: 4.06M USDT (Binance) Price: 0.532 (-2.2% in 24h)

Hashtags

American Crypto©

@americancryptotrading · Post #27413 · 21.10.2025 г., 11:26

🇺🇸#ETHFI/USDT is trending above the broken descending channel on the 3D timeframe🧐 More upside after the bounce🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27264 · 29.05.2025 г., 09:46

🇺🇸#ETHFI/USDT is nearing a breakout from the descendingresistance on the 2D chart🧐 Bullish on a breakout📈 American Crypto©

Hashtags

Coinlegs Cryptocurrency Signals

@coinlegs · Post #10230 · 28.04.2024 г., 07:55

#ETHFI Here's a closer look at the technical analysis: • Volume has been steadily increasing over the past three days. • The 5-day Exponential Moving Average (EMA5) has crossed over the 20-day EMA, indicating a positive trend. • While the Relative Strength Index (RSI) is high in lower time frames, it remains relatively low on the daily chart. The price has broken out of resistance with significant volume. If it can sustain this momentum without retracing back into the previous range, there's potential for further upward movement

Hashtags

Crypto

@signal_bitcoins · Post #5079 · 16.12.2024 г., 11:27

Bingx Futures (LONG) 📶#ETHFI/USDT 📈Enter price: 2.77 🔛 2.67 1️⃣ Target: 2.852 2️⃣ Target: 2.935 3️⃣ Target: 3.017 ⛔️ Normal Stop Loss: 2.605 ⚠️ 1% Risk (Isolated 3X)

Hashtags

12
ПретходнаСтраница 1 од 2Следна