Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

replace substrings in python

s = 'one two one two one'
print(s.replace(' ', '-'))
# Output -
# one-two-one-two-one

s = 'one two one two one'
print(s.replace(' ', ''))
# Output -
# onetwoonetwoone
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #replace #substrings #python
ADD COMMENT
Topic
Name
5+2 =