malformedurlexception

How to validate a url in Python? (Malformed or not)

How to validate a url in Python? (Malformed or not) Question: I have url from the user and I have to reply with the fetched HTML. How can I check for the URL to be malformed or not? For example : url = ‘google’ # Malformed url = ‘google.com’ # Malformed url = ‘http://google.com’ # …

Total answers: 16