remove word from string python

38

remove word from string python -

#You can remove a word from a string using str.replace ()
myString = 'papa is a good man'
newString = myString.replace('papa', '')
>>>' is a good man'

remove word from string in python -

#you can use replace function to remove specific word.
message = 'you can use replace function'
message = message.replace('function', '')
print(message)

Comments

Submit
0 Comments