新手提问 python for循环问题 print (y) #这里为什么只输出一行?
importrei1=open('test.txt','r').read()str=input('初始值:')str1=input('结束值:')i2=re.findal...
import re
i1 = open('test.txt','r').read()
str =input('初始值:')
str1 =input('结束值:')
i2 = re.findall(r""+str+"(.*?)"+str1+"", i1, re.MULTILINE | re.DOTALL)
for i in i2:
print (i) #到这里正确
x = i
str2 =input('初始值:')
str3 =input('结束值:')
i3 = re.findall(r"("+str2+".*?"+str3+")",x, re.MULTILINE | re.DOTALL)
for y in i3:
print (y) #这里为什么只输出一行?
test.txt:这是里面的内容
hello
hlllllllll
eeee11
dfsfsd
333
hi
hello
hlllllllll
eeee11
dfsfsd
333
hi
hello
hlllllllll
eeee11
dfsfsd
333
hi 展开
i1 = open('test.txt','r').read()
str =input('初始值:')
str1 =input('结束值:')
i2 = re.findall(r""+str+"(.*?)"+str1+"", i1, re.MULTILINE | re.DOTALL)
for i in i2:
print (i) #到这里正确
x = i
str2 =input('初始值:')
str3 =input('结束值:')
i3 = re.findall(r"("+str2+".*?"+str3+")",x, re.MULTILINE | re.DOTALL)
for y in i3:
print (y) #这里为什么只输出一行?
test.txt:这是里面的内容
hello
hlllllllll
eeee11
dfsfsd
333
hi
hello
hlllllllll
eeee11
dfsfsd
333
hi
hello
hlllllllll
eeee11
dfsfsd
333
hi 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询