Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
🛰️ Flags of the #Kaliningrad Region and the City of Zelenogradsk are back from #ISS🌍 to be later exhibited in #Kaliningrad Regional Museum of History and Arts.
📸 by the Museum
🚀🌍Le commandant de l'ISS et envoyé spécial de TASS à bord, Sergueï Koud-Svertchkov, a montré des images du vaisseau spatial Crew Dragon approchant de la station.
#iss#espace
LIVE: Farewells, hatch closing for Soyuz MS-18 crew on ISS
Farewells and hatch closing for the Soyuz MS-18 crew on the International Space Station.
#Reuters#Live#News#Space#ISS
➖@reutersworldchannel➖
🇷🇺🛰️ Le vaisseau cargo Progress MS‑32 s’est désamarré du module Zvezda du segment russe de la Station spatiale internationale (ISS) avant l’arrivée d’un nouveau cargo, montre la retransmission de Roscosmos.
#russie#vaisseau#iss