Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove special characters from string with for loop python

text = "I! want, to? eat."
chars = ".!,?"
for i in range(len(chars)):         #can't use len() alone b/c int obj is not iterable
    text = text.replace(chars[i], "")
    
print(text)     #I want to eat
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #special #characters #string #loop #python
ADD COMMENT
Topic
Name
4+3 =