Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
⚠️ A whale who supplied 56,995 $WETH ($90.8M) to borrow $DAI on #Maker is on the verge of liquidation, with a liquidation price of $1,564.58.
Earlier today, another giant whale was already liquidated for 67,569 $ETH ($106M) at $1,650 to repay a $74.49M loan as the price plunged!
In the past 24 hours, $898M, mostly from long positions, was liquidated from the cryptocurrency market.
Follow @spotonchain for more insights at https://x.com/spotonchain/status/1909075294834848057