Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
Subaru unveils Project Midnight, the fastest WRX in history .
🔥 With a 2-liter racing flat-four engine boosted to 670 hp and 680 Nm of torque, this beast revs up to an impressive 9500 rpm .
🚗💨 Weighing only 1120 kg thanks to a carbon fiber body, it sheds a whopping 453 kg for lightning-fast performance .
⚡️ And of course, it's equipped with all-wheel drive for that perfect grip! Don't miss the live debut at the Goodwood Festival of Speed 🏁
#Subaru#ProjectMidnight#WRX#GoodwoodFoS#Auto🏎💥
📸Exciting news from the automotive world! The first electric MINI JCW E will be revealed on 11 July at the 'Festival of Speed' in Goodwood.
🤫 Stay tuned for more details on the powertrain, although with options like a 184bhp motor with a 40.7kWh battery and a 218bhp motor with a 54.2kWh battery in the electric MINI Cooper SE, we can expect the JCW version to pack even more power.
📆 While the MINI JCW E PROtotype will be showcased in action at the event, the full details will be unveiled later this year. MINI also hints that the JCW lineup will feature both electric and gasoline models.
#ElectricVehicles#MINIJCW#GoodwoodFOS#AutomotiveInnovation#MINICooperSE#FutureOfMobility#Auto