求助Python有没有会做的?

求助Python有没有会做的?


回答:

python">def print_content(strings):

results = []

start_idx = 0

end_idx = 0

for i,strs in enumerate(strings):

if strs.startswith("START"):

if end_idx > start_idx and i > end_idx:

results.append([start_idx+1,end_idx])

end_idx = 0

start_idx = i

else:

start_idx = i

if strs.startswith("END") and end_idx == 0:

end_idx = i

for start_idx,end_idx in results:

for j in range(start_idx,end_idx):

print(strings[j])

以上是 求助Python有没有会做的? 的全部内容, 来源链接: utcz.com/p/938673.html

回到顶部