Python beginner, very fond of the insect master's article.
A little bug,http://www.cnblogs.com/fnng/p/3782515.html was found during the practice.
Verify the mailbox format the third x does not allow numbers, but the test found [email protected] still shows that the verification email address is correct
found that Re.match () matches only the beginning, so think of the method of grouping, the code is as follows:
1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 #myemails.py4 5 6 ImportRe7 8 defMyemails (E):9 ifLen (e) >= 5:Tenm = Re.match (r'([a-za-z0-9]+?) \@ ([a-za-z0-9]+?) \. ([a-za-z]+)', E) One ifM.group (0) = =e: A return 'The mailbox format is correct! ' - return 'Incorrect mailbox format' - theE = Raw_input ("Please enter email:") - Printe -A =myemails (e) - PrintA
A bit of experience, if there are errors, but also asked the great God, thank you!
A fix for a small bug