|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
symbol = r'''`!@#$%^&*()_+-=/*{}[]\|'";:/?,.<>'''
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
num = '0123456789'
temp = input('your password:')
passwords = str(temp)
length = len(passwords)
i = 0
n = 0
if length < 8:
i = 1
if length >= 8 and length < 16:
i = 2
else:
i = 3
for pw in passwords:
if pw in symbol:
n += 1
break
for pw in passwords:
if pw in chars:
n += 1
break
for pw in passwords:
if pw in num:
n += 1
break
if i == 1 or n == 1:
print('Your password is unsafe!')
elif i == 2 or n == 2:
print('Your password is good!')
else:
print('Your password is very safe!')
输入的密码有字母以后:
your password:123123s
Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/11.py", line 4, in <module>
temp = input('your password:')
File "<string>", line 1
123123s
^
SyntaxError: unexpected EOF while parsing
本帖最后由 jackz007 于 2019-4-19 18:17 编辑
楼主的 Python 是 2.x 版的吧,解决方法是,输入的时候加上单引号,像这样:'123123s',如果不想这样,把 input() 改成 raw_input() 就可以了。Python 2.x 的 raw_input() 实际上就是 3.x 版本下的 input()。
论坛里面主要讨论的是 Python 3.x,然而,我和你一样,观念比较守旧,到现在都依然没有碰过 3.x 的 Python。
|
|