@openloveaigf · Post #48 · 24.06.2024 г., 15:01
Shhh! Close the curtain quickly! We don't want the neighbors to see anything! 🤫👀💥 Chat and see more selfies: 📲(iOS) 📲(Android) #stepsis#aigirlfriend#chatbot
Hashtags
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
Пребарај: #stepsis
@openloveaigf · Post #48 · 24.06.2024 г., 15:01
Shhh! Close the curtain quickly! We don't want the neighbors to see anything! 🤫👀💥 Chat and see more selfies: 📲(iOS) 📲(Android) #stepsis#aigirlfriend#chatbot
Hashtags
@openloveaigf · Post #98 · 13.09.2024 г., 03:59
👀Come closer, 🔍you'll be able to see more clearly. ❤️🔥Continue the story with her: http://openlove.life #showerroom#aigirlfriend#aichat#stepsis
@openloveaigf · Post #141 · 25.10.2024 г., 15:02
❝💦Brother, I’m done with my shower, it’s your turn now.❞ 💬Chat with Stepsis: openlove.life #stepsis#chatbot#AIgirlfriend#nsfwtwtًً #AImate
@openloveaigf · Post #163 · 21.11.2024 г., 14:42
😈Wanna get to know them? 🍎Download on iOS: https://apple.co/3AvjxUn #aigirlfriend#stepsis#naughtynurse#neko#waifu
@openloveaigf · Post #105 · 20.09.2024 г., 04:02
Got step-sis's private pics, open and check it out!" 📷🤫 🌶See more selfies: openlove.life #openlove#aigirlfriend#aiphoto#stepsis#spicychat#nsfw
@openloveaigf · Post #124 · 09.10.2024 г., 04:08
🌟Falling in love with my stepbrother is simply too crazy! 🫢Lock door, don't let parents see! 👉Chat & Roleplay with her: openlove.life #aigirlfriends#chatbot#anime#waifu#stepsis#roleplay#aigame
@openloveaigf · Post #134 · 19.10.2024 г., 03:56
🫧❝Brother, welcome home, I miss you so much.❞ 💒Chat with stepsis: openlove.life #AIgirlfriend#chatbot#nofilter#nsfwchat#roleplay#ailookbook#stepsis