How can I check if a URL is absolute using Python?

前端 未结 4 1073
旧时难觅i
旧时难觅i 2020-12-10 10:20

What is the preferred solution for checking if an URL is relative or absolute?

4条回答
  •  难免孤独
    2020-12-10 11:00

    Not sure what you're asking about. Are you just looking to see if it begins with http:// ? IF so, a simple regex will do the trick.

    (EDIT: See comment below -- a very good point!!)

提交回复
热议问题