Source Code:
(back to article)
string = 'Hello, world!' substring = 'world!' # Replace the substring with an empty string result = string.replace(substring, '') print(result) # Output: 'Hello, '
Result:
Report an issue