+ 1
Password Validation 3.0
Is there a better option to check for special characters without looping over a custom list? https://code.sololearn.com/cHZerh8WUO8i/?ref=app
8 Antworten
+ 3
Oh sorry
I wanted to ask if there is a better way to check if the password contains any special characters, without looping over a custom list
+ 3
Use regular expressions(re module)
import re
password = raw_input("Enter string to test: ")
if re.match(r'[A-Za-z0-9@#$%^&+=]{10,}', password):
# match
else:
# no match
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2475/
+ 3
What is the difference between raw_input and input?
And what {10,} stands for?
+ 2
Boseka
What is your question ?
+ 1
This may help u
https://code.sololearn.com/c9Nih6K1gKl4/?ref=app
0
password = list(input())
str = " ".join(password) #a string with space b/w the items
import re
symb = re.findall("[!@#\$%&\*]+", str)
num = re.findall(r"[0-9]+", str)
filt = filter((lambda x: x in symb,str), (password))
print ("Strong" if len(symb) >= 2 and len(num) >= 2 and len(password) >=7 else "Weak")
- 1
no