Python-如何在python中验证网址? (格式是否正确) [英] Python - How to validate a url in python ? (Malformed or not)

查看:1129
本文介绍了Python-如何在python中验证网址? (格式是否正确)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从用户那里得到了url,我必须用获取的HTML进行回复.

I have url from the user and I have to reply with the fetched HTML.

如何检查URL的格式是否正确?

How can I check for the URL to be malformed or not ?

例如:

url='google'  // Malformed
url='google.com'  // Malformed
url='http://google.com'  // Valid
url='http://google'   // Malformed

我们如何实现这一目标?

How can we achieve this ?

推荐答案

django网址验证正则表达式(

这篇关于Python-如何在python中验证网址? (格式是否正确)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆