@ncdcgov · Post #4574 · 02.12.2025 г., 19:45
Stay safe this festive season 🎄✨ #Lassa fever is real — keep your food tightly covered and protected NCDCNigeria #LassaFever#HealthyLiving
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
Пребарај: #lassa
@ncdcgov · Post #4574 · 02.12.2025 г., 19:45
Stay safe this festive season 🎄✨ #Lassa fever is real — keep your food tightly covered and protected NCDCNigeria #LassaFever#HealthyLiving
Hashtags
@ncdcgov · Post #4537 · 18.09.2025 г., 14:16
#Lassa Fever is highly infectious but preventable! ✨Keep your meals safe — store food properly, maintain good hygiene, and protect your loved ones. Hygiene is your first line of defense! 🛡️ Stay Informed, Stay Safe! #LassaFever#StaySafe#NCDCNigeria
@ncdcgov · Post #4522 · 04.09.2025 г., 17:41
#Lassa fever is a viral infection spread mainly through contact with food or household items contaminated by urine or droppings of infected rats.🐀 To prevent this spread; ✅ Store food in tightly covered containers to keep rodents away. ✅ Dispose of garbage properly and keep your surroundings clean. ✅ Avoid bush burning that drives rats into homes. ✅ Practice good hand hygiene—wash your hands regularly with soap and water. ✅ Seek medical attention immediately if you develop fever, weakness, or bleeding. Stay informed, Stay healthy! #StaySafe#HealthyLiving#NCDCNigeria
@ncdcgov · Post #4575 · 04.12.2025 г., 07:28
A clean home is your first defence against #Lassa fever. ☑️Store food properly and dispose of waste the right way. Don’t give rats a chance to thrive. Together, we can stay protected. #LassaFever#StayHealthy#NCDCNigeria
@ncdcgov · Post #4606 · 20.02.2026 г., 10:03
#Lassa fever is preventable, awareness is your first line of defense. ✅Avoid contact with rodents and their droppings ✅Store food properly ✅Maintain good hygiene by washing your hands regularly and keeping your surroundings clean and rodents free Seek medical care early if you notice symptoms such as : ✔️Fever ✔️Weakness ✔️Severe headache ✔️Cough ✔️Sore throat Stay informed, Stay Safe!! Prevent. Detect early. Save lives. #LassaFeverAwareness#PublicHealth#NCDCNigeria
@ncdcgov · Post #4571 · 10.11.2025 г., 12:17
#Lassa fever is a serious viral illness spread through contact with infected rodents or contaminated food and household items. ✔️Protect your health and community by reducing rodent exposure and practicing good hygiene always. Stay alert, stay informed, stay safe! #LassaFever#HealthAwareness#StaySafe#NCDCNigeria
@ncdcgov · Post #4597 · 11.02.2026 г., 15:55
#Lassa fever is not caused by witchcraft or spiritual attacks. It is a viral disease transmitted through contact with urine or droppings of an infected rat, contaminated food, or the body fluids of an infected person. Knowing the facts helps us act early and save lives. If you or anyone around you has a persistent fever, visit the nearest health facility immediately. #LassaFever#KnowTheFacts#PublicHealth#NCDCNigeria