s = 'abc12321cba' print(s.replace('a', ''))
"Str*ing With Chars I! don't want".replace('!','').replace('*','')
s = 'ab12abc34ba' print(s.replace('ab', ''))
>>> papa = 'papa is a good man' >>> papa.replace('papa', '') ' is a good man'
url = 'abcdc.com' print(url.replace('.com',''))
import re url = 'abcdc.com' url = re.sub('\.com$', '', url)
string = 'Hello WorldR' # Lets say for instance you want to remove the R to display # Hello World print(string[:-1]) """ The [:-<number of chars>] to remove from string starting from right to left """