Created
May 18, 2020 23:50
-
-
Save h4ndzdatm0ld/eea413ae2b76ee4a906a294664bd1f1d to your computer and use it in GitHub Desktop.
Remove Subnet Mask from IP Addy
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
def get_ip_only(ipadd): | |
''' This function will use REGEX to strip the subnet mask from an IP/MASK addy. | |
''' | |
try: | |
ip = re.sub(r'/.+', '', str(ipadd)) | |
return ip | |
except Exception as e: | |
print(f"Issue striping subnetmask from {ipadd}, {e}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment