mirror of
https://github.com/ada-dmitry/lab6.git
synced 2026-09-24 09:20:15 +00:00
18 lines
385 B
Python
18 lines
385 B
Python
from datetime import datetime
|
|
|
|
def max_len(vals, index):
|
|
tmp = -1
|
|
for i in vals:
|
|
tmp = max(tmp, len(i[index]))
|
|
if index == 2:
|
|
return max(tmp, 3)
|
|
return max(tmp, 7)
|
|
def check_format(val):
|
|
format = "%Y-%m-%d"
|
|
res = True
|
|
try:
|
|
res = bool(datetime.strptime(val, format))
|
|
except ValueError:
|
|
res = False
|
|
return not(res)
|