我想在 pandas 中接受用户在正则表达式中的输入

I want to take user input in regular expression in pandas

下面是我的代码。

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)
import pandas as pd
import re
text = "monotonous monumental Hello friday monoclonal"
mon = input('please write first three letters which you want to find ? ')
pattern = re.compile(mon+'\w{4}')#here in place of 'mon' I want to use user input
match = pattern.findall(text)
print(match)

这应该有效。