'I want to take user input in regular expression in pandas

Below is my code.

import pandas as pd

import re

text = "monotonous monumental  Hello friday monoclonal"

mon = input('please write first three letters which you want to find ? ')

Number = int(input('please write how many number you want to extract after three letters ? '))

pattern = re.compile(mon+'\w{Number}') #here in place of '{Number}' I want to use user input

match = pattern.findall(text)

print(match)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source