Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
That's my global popstar right there..
For me, Jungkook has the best vocals in the K-pop industry. His voice always shocks me—how can a human being have such a perfect voice? And fun fact: he always sounds exactly like the studio version whenever he sings on Weverse Live. He always strives for perfection; even while dancing, he sounds amazing.
I am really proud to be a fan of Jungkook and BTS.💜
#jungkook | #editvideo
@letjungcook70
happy birthday to Jungkook🎂Wishing you health, happiness, and everything you’ve been dreaming of this year.🥳, the golden maknae! You’re the sparkle in my life🫶💫😍
#jungkook | #editvideo | #HBD_EDIT
@letjungcook70