In this example we will show how to replace blank spaces with hyphens in strings.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
str = input("Please input the string: ")
newStr = str.replace(" ", "-")
print("After replacing: ", newStr)
Output:
Please input the string: a b c d
After replacing: a-b-c-d