Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
Palestinians in Gaza are being starved, denied aid, genocided- and this is all on live stream and on our watch. A statement from Yasemin Acar, FFC volunteer on ‘Madleen’ who was kidnapped by IOF, forcibly taken to Israel and currently being held in detention is delivered by her brother J. Acar. This is the real story.
#FreeGaza#BreakTheSiege
#Madleen#EndTheGenocide
I rarely use the word "hero" for individuals, as I believe true heroism often lies in collective acts—like the unwavering spirit of the people of Gaza. But the justice and solidarity activists on the Gaza Freedom Flotilla, Madleen are undeniably heroes. They embody both individual courage and a global shift towards solidarity with Palestine, standing against the Israeli genocide in Gaza.
Thank you to everyone on the Flotilla and to all who supported their valiant efforts.
#GazaFreedomFlotilla#FreePalestine#StandWithGaza#EndTheGenocide#GazaGenocide#Gaza