📅  最后修改于: 2022-03-11 14:46:45.491000             🧑  作者: Mango
def check(S):
if len(S) != 19 and S[4] != '' and S[9] != '' and S[14] != '':
return False # checking if the format is correct
S = S.replace(" ",'') # Taking away spaces in the string
if not S.isdigit():
return False # checking that the string has only numbers
L = []
for i in S:
i = int(i) # Making a list out of the string and converting each character to an integer so that it the list can be summed
L.append(i)
if sum(L)//10 != 0: # checking to see if the sum of the list is divisible by 10
return False