Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
A mid-career switch from worldwide travel to the tech and gaming world is unusual but for Nelly Lee, it was one of necessity. Read on to find out how she upskilled to pull it off 💪go.gov.sg/ssg-20240530tg
#SkillsFuture#Lifelonglearning
Searching for a better way to serve the community, Bony found his calling in the healthcare industry 🩺 Discover why Bony made the switch here 👉https://go.gov.sg/ssg-20241003tg1
#SkillsFuture#LifelongLearning#Midcareer
With graduation round the corner, Norazlina is eager to explore her next educational pursuits 🎓 Discover her upskilling journey here ➡️https://go.gov.sg/ssg-20240903tg
#SkillsFuture#LifelongLearning#Midcareer
Are you at a pivotal point in your career? 🤔 Seek guidance through our Skills and Training Advisory to chart the most optimal route forward for your professional journey 👉🏻go.gov.sg/ssg-20240521tg
#SkillsFuture#Lifelonglearning#midcareer