

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 remove tabs and newlines using Python regular expression?
The following code removes tabs and newlines from given string
Example
import re print re.sub(r"\s+", " ", """I find Tutorialspoint helpful""")
Output
This gives output
I find Tutorialspoint helpful
- Related Questions & Answers
- How to strip spaces/tabs/newlines using Python regular expression?
- How to match whitespace but not newlines using Python regular expressions?
- How to remove white spaces using Java Regular Expression (RegEx)
- How to write Python Regular expression to remove non unicode characters?
- How to check if text is “empty” (spaces, tabs, newlines) in Python?
- How to match a word in python using Regular Expression?
- How to match nonword characters in Python using Regular Expression?
- How to match a whitespace in python using Regular Expression?
- How to match only digits in Python using Regular Expression?
- How to extract numbers from text using Python regular expression?
- How to extract date from text using Python regular expression?
- How to match tab and newline but not space using Python regular expression?
- How to match anything except space and new line using Python regular expression?
- How to write a Regular Expression in JavaScript to remove spaces?
- How to match a single character in python using Regular Expression?
Advertisements