Original address https://www.cnblogs.com/wangboqi/p/7455240.html
Strict analysis: symbols other than numbers or letters (spaces, semicolons, etc.) will be False
isalnum() must be numbers and letters Mixed
isalpha() is case insensitive
str_1 = "123" str_2 = "Abc" str_3 = "123Abc" #Use the isdigit function to determine whether a number print (str_1.isdigit()) Ture print(str_2.isdigit()) False print(str_3.isdigit()) False #Use isalpha to determine whether the letter print (str_1.isalpha()) False print(str_2.isalpha()) Ture print(str_3.isalpha()) False # isalnum determines whether the combination of numbers and letters print (str_1.isalpha()) False print(str_2.isalpha()) False print(str_1.isalpha()) Ture