/  Technology   /  Python Program to fetch lower case characters from given paragraph
pandas-exercises

Python Program to fetch lower case characters from given paragraph

Regular Expressions aka “re” in Python helps us to identify the small characters between alphabets a and m in the given text.

We import re which is Regular Expression module in Python

import re


Here the text is “Death in Deodars”

txt = "Death in deodars"


#Find all lower case characters alphabetically between “a” and “m”:

x = re.findall("[a-m]", txt)
print(x)


Output :

[‘e’, ‘a’, ‘h’, ‘i’, ‘d’, ‘e’, ‘d’, ‘a’]


Below is the complete code:

import re
txt = "Death in deodars"
x = re.findall("[a-m]", txt)
print(x)

Leave a comment