我正在尝试查看如何查看用户输入的数字。我尝试使用,.isdigit()但仅在数量上有效。即时通讯试图将其添加到密码检查器。我也尝试过,.isalpha()但是没有用。我做错了什么,我需要添加或更改什么?
这是我所拥有的
password = input('Please type a password ')
str = password
if str.isdigit() == True:
print('password has a number and letters!')
else:
print('You must include a number!')`
Run Code Online (Sandbox Code Playgroud)