You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doc of str.isalnum() only says alphanumeric which is less clear because we don't clearly know both of alphabetic and numeric characters or either of alphabetic or numeric characters as shown below:
Return True if all characters in the string are alphanumeric and there is at least one character, False otherwise. ...
So, the doc of str.isalnum() should say alphanumeric(alphabetic and/or numeric) which is more clear as shown below:
Return True if all characters in the string are alphanumeric(alphabetic and/or numeric) and there is at least one character, False otherwise. ...
print('abc123'.isalnum())
print('abc'.isalnum())
print('123'.isalnum())
# Trueprint('a b c 1 2 3'.isalnum())
print('a b c'.isalnum())
print('1 2 3'.isalnum())
# False