String to slug
Converts a string to a URL-friendly slug.
- Use
str.lower()
andstr.strip()
to normalize the input string. - Use
re.sub()
to to replace spaces, dashes and underscores with-
and remove special characters.
Converts a string to a URL-friendly slug.
str.lower()
and str.strip()
to normalize the input string.re.sub()
to to replace spaces, dashes and underscores with -
and remove special characters.