>>> papa = 'papa is a good man'
>>> papa.replace('papa', '')
' is a good man'
s = 'ab12abc34ba'
print(s.replace('ab', ''))
s = "Earthworms and Python are disgusting!"
s.replace('and Python ', '')
print(s)
#Run the code
result = "Earthworms are disgusting!"
text='ramkumar'
text=text.replace("mku","") #'' is empty
print(text)
ans:
ramar
"Str*ing With Chars I! don't want".replace('!','').replace('*','')
txt = 'abbacabbd'
print(url.replace('bbd',''))
#output:
abbaca
url = 'abcdc.com'
print(url.replace('.com',''))
re.sub(r'([^)]*)', '', filename)
Food = ["Apple", "lemon", "Mango"]
Food.append("Cake")
Food.remove("lemon")
for x in Food:
print(x)
import re
url = 'abcdc.com'
url = re.sub('.com$', '', url)
shop = ["Python", "js" , "c#"]
shop.remove("js")
for x in shop:
print(x)