Is there a programatic way to find the domain name from a given hostname?
given -> www.yahoo.co.jp return -> yahoo.co.jp
The approach that works but is very slo
You can use partition instead of split:
split
>>> 'www.yahoo.co.jp'.partition('.')[2] 'yahoo.co.jp'
This will help with the parsing but obviously won't check if the returned string is a valid domain.