Python: How to use slugify with examples

Syntax

slugify(string)

python-slugify Example

from slugify import slugify

# String
string = "how to use Slugify"

# Convert String To Slug
slug = slugify(string)

# Print
print(slug)

Output:

how-to-use-slugify

 

 

# String
string = "Hello & Py+only+code"

# Convert String To Slug
slug = slugify(string)

# Print
print(slug)

Output:

hello-py-only-code