Python: Replace/remove string between two delimiters/characters

This Python code helps you to

  • to replace a string between two delimiters or characters
  • delete/remove string between two characters or delimiters

Python code to replace string between two delimiters

Python code to delete/remove string between two characters/delimiters

Replace 5th line of above code with below one

Note: This code works in both Python 2 and 3

Read below post if you want to get/find sub string between two delimiters/characters within a string

https://gethowstuff.com/python-script-extract-string-two-delimiters/

About the Author

SRINI S

A passionate blogger. Love to share solutions and best practices on wordpress hosting, issues and fixes, excel VBA macros and other apps

Leave a Reply

Your email address will not be published. Required fields are marked *