Homework---Modify the haproxy configuration file

#Inquire
f=open("C:\\aaaaaaaaaaaaa\\haproxy.txt", "r", encoding="utf-8")
haproxy_list = f.readlines()
website_address = input("Please enter the URL to query: ")
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("The content you entered cannot be searched")
    i+=1
if i == lenth and j==1:
    print("The content you entered cannot be searched")
f.close()

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325238538&siteId=291194637