is_url¶
- pyhelpers.ops.is_url(url, partially=False)[source]¶
Check if
url
is a valid URL.See also [OPS-IU-1].
- Parameters:
url (str) – A string representing the URL to be checked.
partially (bool) – Whether to consider the input as partially valid; defaults to
False
.
- Returns:
True
if the given URL is a valid URL;False
otherwise.- Return type:
bool
Examples:
>>> from pyhelpers.ops import is_url >>> is_url(url='https://github.com/mikeqfu/pyhelpers') True >>> is_url(url='github.com/mikeqfu/pyhelpers') False >>> is_url(url='github.com/mikeqfu/pyhelpers', partially=True) True >>> is_url(url='github.com') False >>> is_url(url='github.com', partially=True) True >>> is_url(url='github', partially=True) False