Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
🏥🇺🇸US HOSPITALS OVERWHELMED BY WAR VETERANS
🔹 VA hospitals at 180% capacity treating wounded soldiers from Iran war 🚑
🔹 Medical staff working 16-hour shifts, mandatory overtime across nation 👩⚕️
🔹 PTSD cases skyrocket 400% among returning troops and military families 🧠
🔹 Mental health crisis: suicide hotlines report 200% increase in calls 📞
🔹 Civilian hospitals forced to treat veterans as VA system collapses 🏥
🔹 Medical supply shortage hits ICUs as resources diverted to military 💊
Healthcare system breaking under war casualties burden 😟⚕️
#healthcare#veterans#PTSD#medical
@america