Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
🌎 Sleeping through winter? The edible dormouse takes hibernation to extremes, snoozing up to 11 months a year in underground burrows to survive food shortages. ✨
#mammals⚡#hibernation⚡#adaptation
👉subscribe Interesting Planet
🌎 In the remote Tibetan Plateau, the Himalayan marmot hibernates for up to 7 months each year. During this deep sleep, its heart rate and body temperature drop dramatically—allowing survival through brutally cold, snowbound winters underground. ✨
#mammals⚡#adaptation⚡#hibernation
👉subscribe Interesting Planet
🇯🇵🐻Au Japon, les ours sortent d’hibernation: un habitant a été tué, un policier blessé, rapporte l’agence Kyodo.
En 2025, treize personnes ont été tuées au Japon à la suite d’attaques d’ours. 230 habitants ont été blessés ou mutilés.
#hibernation#ours#attaques