I have some strings which starts with dots, and I want to delete it. Which is the best way.
And if the next caracter isn’t a “/” add it.
I’m new in python and I’ve been trying to do something like this to erase dots but there is a syntax error.
while (re.match(r'\.*', url[0]).end()) = 0:
url = url[1:]
- …./xxx —> /xxx
- .xxx —> /xxx
- ..ab —> /ab
- /ab —> /ab
- ca —> /ca
This is what I’m trying to do.
To get rid of the dots:
and the result should be:
regardless of whether it begins with dots or slashes (they all will be replaced with single slash).