import re
i1 = open('test.txt','r').read()
str_input = input("please input:")
i2 = re.findall(r"%s(.*?)hi"$str_input, i1, re.MULTILINE | re.DOTALL)
for i in i2:
print (i)
我没实验,你先看看行不行
str =input()
i2 = re.findall(r""+str+"(.*?)hi", i1, re.MULTILINE | re.DOTALL)
字符串直接拼接就行