Processing HTML : Urlparse : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Urlparse »

 

Processing HTML


import urlparse

URLscheme = "http"
URLlocation = "www.python.org"
URLpath = "lib/module-urlparse.html"

modList = ("urllib""urllib2""httplib""cgilib")

parsedTuple = urlparse.urlparse("http://www.google.com/search?hl=en&q=urlparse&btnG=Google+Search")
print parsedTuple

unparsedURL = urlparse.urlunparse((URLscheme, URLlocation, URLpath, '', '', ''))
print unparsedURL

for mod in modList:
    newURL = urlparse.urljoin(unparsedURL, "module-%s.html" (mod))
    print newURL

newURL = urlparse.urljoin(unparsedURL,"module-urllib2/request-objects.html")
print newURL



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Urlparse