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

Резултати

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

Пребарај: #altcoins

当前筛选 #altcoins清除筛选
Coin Signals

@coin_signals · Post #16875 · 11.08.2025 г., 19:28

📊 There is no strength in the market; very few coins have posted double-digit returns in the past 7 days. First, LTC pumped, then ETH, and then BTC. The overall market is not trending upward together. (possibility of exit pumps) $BTC Bullish if holds above $121k. $ETH Bullish Right Now #Altcoins still Bearish.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4828 · 13.09.2024 г., 10:18

The markets are heating up for a strong October and November. That's why you want to be positioned into strong #Altcoins. $OM is one of them, only 24% down from the ATH, it's looking primed for a strong continuation in upcoming months.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4824 · 12.09.2024 г., 10:26

#Altcoins are doing relatively well. $SEI continues to find momentum, and I'd like to see it rally to $0.34 (preferably even above the previous high, but not expecting that yet), make an HL, and continue that rally to $0.44 in October.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4795 · 09.09.2024 г., 13:30

#Altcoins are doing great, silently. $OP has been gaining momentum, up 28% since the recent low. Rounded bottom with a 3-day bullish divergence. Needs to break through 2750-2850 sats, and then the divergence becomes valid. Expecting a big breakout.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4789 · 08.09.2024 г., 10:40

The #Altcoins show a potential bullish divergence on the Others/BTC chart. Very important, as that might be an indicator of what's going to come. The bottoming process is fully in place.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4787 · 07.09.2024 г., 16:08

Ethereum #altcoins aren't doing bad, as $OP is currently up from the lows. However, on the larger scale, it's currently down substantially and it's back to the lows. I'm expecting a lot more upside to come on this one once EigenLayer comes into action.

Hashtags

Michaël Van de Poppe Official

@michaelvandepoppeanalyst · Post #4776 · 06.09.2024 г., 16:52

#Altcoins aren't doing that wrong, as $SEI is currently looking at a crucial support test. I'd like to see $SEI stay above $0.24. If that's the case, we'll be good to go towards $0.45.

Hashtags

123•••10•••20•••2526
ПретходнаСтраница 1 од 26Следна