forked from BugginhoDeveloper/mini-projeto-4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.py
More file actions
32 lines (26 loc) · 883 Bytes
/
validation.py
File metadata and controls
32 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import re
def checkString(tested_string, min, max):
if (len(tested_string) < min) or (len(tested_string) >= max):
print "Desculpe, quantidade de caracteres invalida, tente novamente \n"
return False
tested_string = tested_string.replace(" ", "")
res = re.match("[A-Z]|[a-z]", tested_string)
if (res is None):
print 'Desculpe, os caracteres digitados sao invalidos. Tente novamente \n\n'
return False
return True
def checkInteger(value, min, max):
if (len(value) < min) or (len(value) > max):
print "Desculpe, quantidade de caracteres invalida, tente novamente\n"
return False
try:
value = int(value)
return value
except ValueError:
print 'Desculpe, os caracteres digitados sao invalidos. Tente novamente \n\n'
return False
def checkPassword(pass1):
if (len(pass1) < 3):
print "Senha muito curta! tente novamente\n"
return False
return True