Strip last period from a host string
You do it like this:
hostname.rstrip('.')
where hostname is the string containing the domain name.
>>> 'domain.com'.rstrip('.')
'domain.com'
>>> 'domain.com.'.rstrip('.')
'domain.com'
You do it like this:
hostname.rstrip('.')
where hostname is the string containing the domain name.
>>> 'domain.com'.rstrip('.')
'domain.com'
>>> 'domain.com.'.rstrip('.')
'domain.com'