how to remove characters from the end of a string in python code example
Example 1: python remove last characters from string
st = "abcdefghij"
st = st[:-1] # Returns string with last character removed
Example 2: remove part of string python
txt = 'abbacabbd'
print(url.replace('bbd',''))
#output:
abbaca
Example 3: remove a part of a string python
url = 'abcdc.com'
print(url.replace('.com',''))