python remove string from variable code example
Example 1: delete certain characters from a string python
for char in line:
if char in " ?.!/;:":
line.replace(char,'')
Example 2: remove a part of a string python
import re
url = 'abcdc.com'
url = re.sub('\.com$', '', url)