|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
下面是检测密码安全性的代码,运行时总是出现 File "1.py", line 36
^
SyntaxError: EOF while scanning triple-quoted string literal
求大神指教
#!/usr/bin/python
2 #coding=utf-8
3 password=raw_input('Enter your password here')
4 length=len(password)
5 if length<=8:
6 leng=0
7 elif length <=16:
8 leng=1
9 else:
10 leng=2
11
12 special=r'''~!@#$%^&*()_=-/,.?<>;:[]{}|\'''
13 num='0123456789'
14 alpha='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
15
16 for i in password:
17 if i in special:
18 has_special=1
19 elif i in num:
20 has_num=1
21 elif i in alpha:
22 has_alpha=1
23
24
25 if leng==0 and isalnum(password):
26 print '低级密码'
27 elif leng==1 and sum([has_special,has_num,has_alpha])>=2
elif leng==2 and sum([has_special,has_num,has_alpha])==3 and isinstance(password[0],str):
30 print '高级密码'
"1.py" 34L, 652C 19,1-8 顶端
|
|