Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
If Donald Trump doesn’t make an attempt to buck the Constitution and run for president once again in 2028, which he has hinted at, his middle son, Eric, has indicated he might like to take his turn in the Oval Office.
#Trump#EricTrump
👂More on Trump's Ear ⚠️
Eric Trump’s Investment Advice Backfires
Eric Trump advised buying Bitcoin and Ethereum, but prices dropped 20% and 30% respectively. World Liberty Financial's portfolio fell by $110 million. His praise messages were deleted after the crash. A false report on ETH purchase circulated, later debunked. For more info, visit ForkLog.
#Bitcoin#Ethereum#Crypto#Investment#MarketCrash#WorldLiberty#FinancialNews#EricTrump#ETH#BTC#Trading#Blockchain#TechNews#Assets#Speculation#Finance#MarketStrategy#News