Extracting domain names and ports in URL links with Python

From , 5 Years ago, written in Python, viewed 242 times.
URL https://pastebin.vip/view/7ec0dbee
  1. import urllib  
  2. proto, rest = urllib.splittype("http://www.sharejs.com/11/12.htm")  
  3. host, rest = urllib.splithost(rest)  
  4. print host  
  5. host, port = urllib.splitport(host)  
  6. if port is None:  
  7.    port = 80  
  8. print port  
  9. #//python/6086

Reply to "Extracting domain names and ports in URL links with Python"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website