how to remove certain portion of string in python code example
Example 1: remove specific word from string using python
#you can use replace function to remove specific word.
>>> message = 'you can use replace function'
>>> message.replace('function', '')
>>>'you can use replace '
Example 2: remove part of string python
txt = 'abbacabbd'
print(url.replace('bbd',''))
#output:
abbaca
Example 3: remove a part of a string python
import re
url = 'abcdc.com'
url = re.sub('\.com$', '', url)