HEX
Server: Apache/2.2.22
System: Linux server1.blueharbor.com 3.10.0-1160.90.1.vz7.200.7 #1 SMP Wed Jul 12 12:00:44 MSK 2023 x86_64
User: locglobe (1004)
PHP: 5.6.37
Disabled: NONE
Upload Files
File: //usr/share/doc/python-dns-1.12.0/examples/name.py
#!/usr/bin/env python

import dns.name

n = dns.name.from_text('www.dnspython.org')
o = dns.name.from_text('dnspython.org')
print n.is_subdomain(o)         # True
print n.is_superdomain(o)       # False
print n > o                     # True
rel = n.relativize(o)           # rel is the relative name www
n2 = rel + o
print n2 == n                   # True
print n.labels                  # ['www', 'dnspython', 'org', '']