Is there an efficient way to strip out numbers from a string in python? Using nltk or base python?
Thanks, Ben
If the developer specifies a set of characters as an argument to the strip() function, it removes those characters or symbols from the beginning and the end of the string to return the original string. What is split and strip Python? Python split() function breaks up a string to return the list of all strings.
Yes, you can use a regular expression for this:
import re
output = re.sub(r'\d+', '', '123hello 456world')
print output # 'hello world'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With