- 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 do i match just spaces and newlines with Python regex?
The following matches and prints just spaces and newlines in the given string using Python regex
Example
import re foo = ' I find Tutorialspoint useful' result = re.findall(r'\s+', foo) print result
Output
This gives the output
[' ', ' ', ' \n ', ' \n ']
Advertisements