Skip to content

Instantly share code, notes, and snippets.

@jorge-lavin
Last active August 29, 2015 14:05
Show Gist options
  • Save jorge-lavin/8c9bd2598efa4f336aa3 to your computer and use it in GitHub Desktop.
Save jorge-lavin/8c9bd2598efa4f336aa3 to your computer and use it in GitHub Desktop.
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