#查询 f=open("C:\\aaaaaaaaaaaaa\\haproxy.txt", "r", encoding="utf-8") haproxy_list = f.readlines() website_address = input("请输入要查询的网址:") website_address = "backend " + website_address lenth=len(haproxy_list) #print(website_address) i=0 j=1 for line in haproxy_list: if website_address in line and line.startswith("backend"): print(haproxy_list[i]) j=i+1 while "backend" not in haproxy_list[j] : print(haproxy_list[j]) j+=1 if j >= lenth: break elif j == lenth and i == lenth: print("你输入的内容查询不到") i+=1 if i == lenth and j==1: print("你输入的内容查询不到") f.close()
作业---修改haproxy配置文件
猜你喜欢
转载自www.cnblogs.com/nickkkk/p/8985829.html
今日推荐
周排行