For Python 3.9+:

text.removeprefix(prefix)

For older versions, the following provides the same behavior:

def remove_prefix(text, prefix):
    if text.startswith(prefix):
        return text[len(prefix):]
    return text
Answer from Elazar on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-remove-prefix-strings-from-list
Python | Remove prefix strings from list - GeeksforGeeks
April 11, 2023 - The original list : ['xall', 'xlove', 'gfg', 'xit', 'is', 'best'] List after removal of Kth character of each string : ['gfg', 'is', 'best'] ... This is another way in which this task can be performed. In this, we don't perform removal in place, instead, we recreate the list without the elements that match the prefix. ... # Python3 code to demonstrate working of # Remove prefix strings from list # using list comprehension + startswith() # initialize list test_list = ['xall', 'xlove', 'gfg', 'xit', 'is', 'best'] # printing original list print("The original list : " + str(test_list)) # initialize prefix pref = 'x' # Remove prefix strings from list # using list comprehension + startswith() res = [ele for ele in test_list if not ele.startswith(pref)] # printing result print("List after removal of Kth character of each string : " + str(res))
Discussions

How to remove a string from a list that startswith prefix in python - Stack Overflow
I tested running for word in list and noticed that some of the strings that contained a prefix weren't being removed. However, when I tried for word in list[:], all the correct string were being removed. 2022-06-01T13:25:55.16Z+00:00 ... I think it's because Python internally tracks the index ... More on stackoverflow.com
🌐 stackoverflow.com
python - Remove a prefix if matches an entry on a list - Stack Overflow
I have a list of strings with some prefixes: prefixes = [u'path', u'folder', u'directory', u'd'] and some strings like s1 = u'path common path and directory' s2 = u'directory common path and dir... More on stackoverflow.com
🌐 stackoverflow.com
regex - How to remove the prefix from each element of python list? - Stack Overflow
I have a python list with items as follows: [ 1.1 ] 1. a electronic bill presentment system. [ 1.2 ] a network. [ 1.3 ] a plurality of first stations, each associated with a respective one of a More on stackoverflow.com
🌐 stackoverflow.com
python - What is the best way to get rid of common substring prefix in Python3? - Stack Overflow
Let's assume we have string and a list of strings: String: str1 = List of strings: [ - , - ] What ... More on stackoverflow.com
🌐 stackoverflow.com
January 17, 2018
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string-removeprefix-function
Python String - removeprefix() function - GeeksforGeeks
July 23, 2025 - Python String removeprefix() function removes the prefix and returns the rest of the string. If the prefix string is not found, then it returns the original string. ... Return Type: The method returns a new string with the specified prefix removed, ...
🌐
Python
peps.python.org › pep-0616
PEP 616 – String methods to remove prefixes and suffixes | peps.python.org
March 19, 2020 - This is a proposal to add two new methods, removeprefix() and removesuffix(), to the APIs of Python’s various string objects. These methods would remove a prefix or suffix (respectively) from a string, if present, and would be added to Unicode ...
🌐
Medium
medium.com › code-85 › how-to-remove-a-prefix-from-a-string-in-python-51bf04714163
How to Remove a Prefix from a String in Python | by Jonathan Hsu | Code 85 | Medium
September 7, 2021 - In this tutorial we’ll go over my old method for removing prefixes from a string and introduce a fresh, newly minted method from version 3.9 that has become my de facto strategy. This is a common design pattern that is applicable in a variety of languages. Essentially, we first check if a string starts with our prefix.
🌐
Codecademy
codecademy.com › docs › python › strings › .removeprefix()
Python | Strings | .removeprefix() | Codecademy
August 28, 2025 - Returns a copy of a string with the specified prefix removed, if present.
Find elsewhere
🌐
Stack Abuse
stackabuse.com › python-remove-the-prefix-and-suffix-from-a-string
Python: Remove the Prefix and Suffix From a String
March 7, 2023 - Python v3.9+ comes with two new functions to make this possible: removeprefix() and removesuffix(). When we are using Python versions less than 3.9, we can use the startswith() and endswith() methods with string slicing to remove a prefix and suffix respectively.
🌐
Python Morsels
pythonmorsels.com › prefixes-and-suffixes
Checking for string prefixes and suffixes in Python - Python Morsels
August 12, 2025 - To remove a prefix or suffix, use the removeprefix or removesuffix methods. If you need to remove repeated characters from either end of a string, check out the various strip methods instead.
🌐
YouTube
youtube.com › watch
Python Tutorial - Prefix and Suffix Removal Methods - YouTube
Learn about the new string prefix and suffix methods in Python 3.9!🎥 Check out our Full Courses: https://eirikstine.github.io/ ▬▬▬▬▬▬ ❤️ Want to Support Us?...
Published: December 20, 2020
Top answer
1 of 4
3

Here's one approach using re.sub:

import re
l = ['[ 1.1 ] 1. a electronic bill presentment system.','[ 1.2 ] a network.']

[re.sub(r'\[\s*\d+\.*\d*\s*\]\s+(?:\d+\.\s*)?', '', s) for s in l]
# ['a electronic bill presentment system.', 'a network.']

See demo


Testing with a larger list of strings:

l = ['[ 1.1 ] 1. a electronic bill presentment system.',\
'[ 1.2 ] a network.',\
'[ 1.3 ] a plurality of first stations, each associated with a respective one of a plurality of users and operable to transmit first requests for bills of its associated user via the network.',\
'[ 1.5 ] a plurality of second network stations, each associated with a respective one of a plurality of billers, configured to receive the transmitted second requests for bills and to transmit, responsive thereto, the requested bills of the associated user via the network.',\
'[ 1.6 ] wherein the bill availability information for the associated user identifies those of the plurality of billers having a bill available for that user without identifying an amount of the bill of each of the identified billers for the associated user.',\
'[ 2.1 ] 2. a method for presenting electronic bills.']

[re.sub(r'\[\s*\d+\.*\d*\s*\]\s+(?:\d+\.\s*)?', '', s) for s in l]

['a electronic bill presentment system.',
 'a network.',
 'a plurality of first stations, each associated with a respective one of a plurality of users and operable to transmit first requests for bills of its associated user via the network.',
 'a plurality of second network stations, each associated with a respective one of a plurality of billers, configured to receive the transmitted second requests for bills and to transmit, responsive thereto, the requested bills of the associated user via the network.',
 'wherein the bill availability information for the associated user identifies those of the plurality of billers having a bill available for that user without identifying an amount of the bill of each of the identified billers for the associated user.',
 'a method for presenting electronic bills.']
2 of 4
2

You should regular expression to substitute the pattern with an empty string

>>> re.sub(r'\[\s?\d\.\d\s?]\s?(\d(\.\s)?)?', '', '[ 1.1 ] 1. a electronic bill presentment system.')
'a electronic bill presentment system.'
🌐
Dirask
dirask.com › posts › Python-remove-prefix-from-string-jE66x1
Python - remove prefix from string
In this example, we use removeprefix() method to remove prefix substring from the string. text = "ABC" print("String before:", text) # ABC text = text.removeprefix("A") print("String after: ", text) # BC · Output: String before: ABC String ...
🌐
pythontutorials
pythontutorials.net › blog › how-to-remove-a-string-from-a-list-that-startswith-prefix-in-python
How to Remove Strings from a List That Start With a Prefix in Python: Fixing ValueError: list.remove(x) x not in list — pythontutorials.net
To avoid ValueError and ensure all matching elements are removed, we need to avoid modifying the list while iterating over it. We’ll explore three safe methods: Idea: Iterate over a copy of the list, so modifications to the original list don’t disrupt the iteration. words = ['unhappy', 'joy', 'unlucky', 'smile', 'unfair'] prefix = 'un' # Iterate over a copy of the list to avoid skipping elements for word in words.copy(): if word.startswith(prefix): words.remove(word) print(words) # Output: ['joy', 'smile']
🌐
Finxter
blog.finxter.com › home › learn python blog › how to remove the prefix of a string in python?
How To Remove The Prefix Of A String In Python? - Be on the Right Side of Change
March 23, 2021 - For example, my_string.removeprefix('xxx') removes the prefix 'xxx' from my_string. >>> 'xxxhello world'.removeprefix('xxx') 'hello world' Note: All the solutions provided below have been verified using Python 3.9.0b5