Python program to check if email address is valid or not
source link: https://www.geeksforgeeks.org/videos/python-program-to-check-if-email-address-is-valid-or-not/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Python program to check if email address is valid or not
- 200 Views
- 19/08/2022
In this video, we will write a python program to check if an email address is valid or not.
We have covered the following in this video:
1. Method #1 (using regex).
2. Dry run of code.
3. Python code to check the validity of an email.
Method 1:
In this method, we used regex to validate an email address based on a predefined pattern. First, we need to import Python's built-in re module. We need to use the re.search() method to check if an email is matching with a certain pattern, in that case, it is valid else it is not valid.
If re.search() returns a value, then it is valid, else the email is of an invalid format.
By this, we can check the validity of emails of multiple domains.
Check if the email address is valid or not in Python:
https://www.geeksforgeeks.org/check-if-email-address-valid-or-not-in-python/
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK