Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
Today we present you: The takahē (Porphyrio hochstetteri)
— a flightless, endemic New Zealand bird, that was once thought extinct and famously rediscovered in 1948 — has been saved from the brink of extinction by intensive conservation: captive breeding, predator control, and protected reserves. Populations have increased but the species remains threatened and needs continued protection. Around 500 birds are now known to survive.
[Learn more here]
Tags: #Takahē#Conservation#NZ#Endangered#LazarusSpecies
🚩Желаю всем такого же прекрасного и раннего открытия зимнего сезона!
#heliboarding#methvenheliski#newzealand#snowboarding
#heliskiing#nz#хелиски#новаязеландия#сноубординг