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

Резултати

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

Пребарај: #legs

当前筛选 #legs清除筛选
Anatomy Art Hub ☮️

@anatomyarthub · Post #5961 · 11.11.2025 г., 04:16

#анатомия#ноги#anatomy#legs Quick Guide: Drawing Legs 1. Proportions The leg is typically 4-4.5 times the height of a character's head (measured in "head" units). The thigh (from the pelvis to the knee) and the shin (from the knee to the ankle) are approximately equal in length. 2. Basic Shapes Thigh: Think of it as two connected cylinders or a cone tapering slightly from the pelvis. The outer thigh is rounder and more convex due to the muscles. Knee: This is the central hinge. Simplify it into a cube or sphere, making sure the kneecap protrudes in the front. Shin: This is the most voluminous part at the back. Simplify the shin into a cylinder that tapers toward the ankle. The calf muscles create a distinctive bulge at the back. @anatomyarthub

Anatomy Art Hub ☮️

@anatomyarthub · Post #2499 · 21.01.2024 г., 07:04

#анатомия#ноги#anatomy#legs Форма ног зависит от формы костей и мышц. Вы можете в этом убедиться, глядя на анатомические рисунки. Наши ноги состоят из следующих костей: 1 — крестец; 2 — тазовая кость; 3 — бедренная кость; 4 — надколенник; 5 — малоберцовая кость; 6 — большеберцовая кость; 7 — кости стопы Самый эффективный способ выучить анатомию ног, как вы помните— это нарисовать скелет ноги, а поверх нее (лучше другим цветом) мышцы. А будущем достаточно схематично обозначать построение ног и накидывать их основную форму The shape of the legs depends on the shape of the bones and muscles. You can see this by looking at anatomical drawings. Our legs are made up of the following bones: 1 - sacrum; 2 - pelvic bone; 3 - femur; 4 - patella; 5 - fibula; 6 - tibia; 7 - foot bones The most effective way to learn the anatomy of the legs, as you remember, is to draw the skeleton of the leg, and on top of it (preferably in a different color) the muscles. In the future, it will be enough to schematically indicate the construction of the legs and outline their basic shape Аяҡ формаһы һөйәк һәм мускул формаһына бәйле. Анатомик һүрәттәргә ҡарап, быға инана алаһығыҙ. Аяҡтарыбыҙ түбәндәге һөйәктәрҙән тора: 1 - һигеҙенсе; 2 - янбаш һөйәге; 3 - бот һөйәге; 4 - быуын аҫты ҡунысы; 5 - бәләкәй һаҡаллы һөйәк; 6 - ҙур бурса һөйәге; 7 - табан һөйәктәре Аяҡ анатомияһын өйрәтеүҙең иң һөҙөмтәле ысулы, иҫләйһегеҙме - ул аяҡ һөлдәһен һүрәтләү, ә уның өҫтөндә (иң яҡшыһы башҡа төҫ) мускулдар. Ә киләсәктә аяҡтарҙың төҙөлөшөн схемалы рәүештә билдәләп, уларҙың төп формаһын һалыу ҙа етә @anatomyarthub

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