change to string.removeprefix(prefix)
This commit is contained in:
parent
bb1161baa9
commit
58c773a0de
1 changed files with 1 additions and 2 deletions
|
|
@ -6,6 +6,5 @@ def strip_web_protocol(string: str) -> str:
|
|||
"""Strips a leading web protocol (ex. \"https://\") as well as \"www.\" from a string."""
|
||||
prefixes = ['https://','http://','www.','www2.']
|
||||
for prefix in prefixes:
|
||||
if string.startswith(prefix):
|
||||
string = string.replace(prefix, '')
|
||||
string = string.removeprefix(prefix)
|
||||
return string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue