Last active
August 29, 2015 14:05
-
-
Save jorge-lavin/8c9bd2598efa4f336aa3 to your computer and use it in GitHub Desktop.
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 string | |
def validate(fqdn): | |
"""docstring for validate""" | |
valid_chars = list(string.ascii_letters + string.digits + '-' + '.') | |
if all(char in valid_chars for char in fqdn): | |
return True | |
else: | |
return False | |
if validate('this is not a valid fqdn'): | |
print('not working as it should') | |
if validate('127.0.0.1'): | |
print ('maybe working as it should') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment