Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
🌳 Hidden Forest & Monkey Kingdom near Durban 🐵
Explore the Hidden Forest Sanctuary in Ballito, where primates roam free in a lush natural haven! Just 40 km (25 mi) north of Durban in KwaZulu-Natal, this gem opened in 2019 and is a must-visit for wildlife lovers.
📍 Ballito, South Africa
🎥 Video: https://www.youtube.com/watch?v=Nfo7xp5YtBE&list=PL6fK0Yu-8iyQTFxtSn5GlKM65_ACMniU3&index=1
#Nature#Monkeys#Travel#SouthAfrica
🌎 In the lush forests of Borneo, the proboscis monkey sports a huge, pendulous nose. This unique feature helps males amplify their calls and attract mates, making it one of nature’s most unusual adaptations for communication. ✨
#borneo⚡#monkeys⚡#evolution
👉subscribe Interesting Planet