- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to escape all special characters for regex in Python?
We use re.escape() to escape the special characters −
The following code shows how all special characters in given string are escaped using re.escape() method
>>> p = '5*(67).89?' >>> re.escape(p) '5\*\(67\)\.89\?'
Advertisements