Created
July 23, 2020 16:53
-
-
Save muthu1809/cd1781e6d8421d40e01f787695687afe to your computer and use it in GitHub Desktop.
landlinewithzerocode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def isLandLine(sentence): | |
landLinePattern = re.compile(r'(((91|0)((\d){2,4}))-)?([1-9][0-9]{5,8})') | |
present = landLinePattern.search(sentence) | |
if present.group(1)==None: | |
std=0 | |
else: | |
std=len(present.group(1)) | |
phone = len(present.group(5)) | |
if (std+phone)==12: or 11: | |
return True | |
else: | |
return False | |
sentence = 'My number is 0462-2921129' | |
landline_present = isLandLine(sentence) | |
if(landline_present): | |
print("Landline number is present in the sentence") | |
else: | |
print("Landline Number is not present in the sentence") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment