Метод строки isidentifier() поможет узнать, подходит ли данная строка в качестве имени объекта.
Вполне может заменить самостоятельно придуманную регулярку.
>>> 'some_name'.isidentifier()
True
Обычное имя переменной
>>> '私は手紙です'.isidentifier()
True
Юникод в качестве имени тоже доступен
>>> '1_name'.isidentifier()
False
Имя не может начинаться с цифры
>>> '੬_name'.isidentifier()
False
Включая все цифры юникода
>>> 'some name'.isidentifier()
False
Пробелы недопустимы
#basic
On January 9, 1493, Columbus saw three “mermaids” near the Dominican Republic. He said, “They are not as beautiful as they are painted, for their faces had some masculine traits.” These were actually manatees, big sea animals with whiskers. Sailors often thought manatees were mermaids because they look a little like people from far away.
🐋🌊
[Read more]
@googlefactss
#History#Animals#Mermaids#Manatees
Manatees find allies in coastal Cuban town
Manatees, nicknamed ‘sea cows,’ are in a critical situation due to poachers, so fishermen and residents of the coastal town of Santa Fe, Cuba, have joined forces to protect them.
#Manatees#seacows#Cuba#News#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖