作业---修改haproxy配置文件
#查询
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配置文件的更多相关文章
- Python3.5 day3作业二:修改haproxy配置文件。
需求: 1.使python具体增删查的功能. haproxy的配置文件. global log 127.0.0.1 local2 daemon maxconn 256 log 127.0.0.1 lo ...
- s12-day03-work01 python修改haproxy配置文件(初级版本)
#!/usr/local/env python3 ''' Author:@南非波波 Blog:http://www.cnblogs.com/songqingbo/ E-mail:qingbo.song ...
- (转)Python3.5 day3作业二:修改haproxy配置文件
原文:http://www.cnblogs.com/iwxk/p/6010018.html
- Python3学习之路~2.10 修改haproxy配置文件
需求: .查 输入:www.oldboy.org 获取当前backend下的所有记录 .新建 输入: arg = { 'bakend': 'www.oldboy.org', 'record':{ 's ...
- python作业:HAproxy配置文件操作(第三周)
一.作业需求: 1. 根据用户输入输出对应的backend下的server信息 2. 可添加backend 和sever信息 3. 可修改backend 和sever信息 4. 可删除backend ...
- python基础-修改haproxy配置文件
需要掌握的知识: 1.函数 2.文件处理 3.tag的用法 4.程序的解耦 需求: 1:查询 2:添加 3:删除 4:修改 5:退出 haproxy.conf 配置文件内容: global log 1 ...
- 用python修改haproxy配置文件
需求: 当用户输入域名的时候,显示出来下面的记录 当用户需要输入添加纪录的时候,添加到你需要的那个域名下面 global log 127.0.0.1 local2 daemon maxconn 256 ...
- 修改haproxy配置文件
需求: 1.查 输入:www.oldboy.org 获取当前backend下的所有记录 2.新建 输入: arg = { 'bakend': 'www.oldboy.org', 'record':{ ...
- 5.修改haproxy配置文件
需求: 1.查 输入:www.oldboy.org 获取当前backend下的所有记录 2.新建 输入: arg = { 'backend': 'www.oldboy.org', 'record':{ ...
随机推荐
- 数据库between and
在此记录一下,between相当于大于等于,and相当于小于,举个例子:select * from A where modefytime between '31-3月 -16' and '1-4月 - ...
- 【5】用vector进行直接插入排序
百分百自己编的程序,越来越觉得编程很好玩了. 但这算是第一次自己用vector这种不是那么无脑的方法编程,只能最多对3个数进行排序wwwww 今天我要回去搬宿舍了,等明天有时间,我一定要把bug找到! ...
- python 对 sqlite3的简单使用
SQLite是一种嵌入式数据库,它的数据库就是一个文件.由于SQLite本身是C写的,而且体积很小,所以,经常被集成到各种应用程序中,甚至在iOS和Android的App中都可以集成.Python就内 ...
- struts2常量配置
常量提供了一个简单的方法来定制Struts应用程序通过定义关键设置修改插件框架和行为. struts-default.xml—基础xml,默认包含这个文件是自动装入struts.xml文件,当我们进行 ...
- Altium Designer 10 执行DRC发现有 Length Constraint 解决办法
在PCB布局连线结束后,执行DRC,结果Length Constraint 报错,如图: 在Design Rules中找对应的规则约束,怎么也找不见. 其实是,在差分对进行等长蛇形绕线的步骤中,约束了 ...
- element-ui隐藏组件scrollbar的使用
话不多说,直接上图 总结:el-scrollbar组件设置高度100%包裹住需要滚动的dom结构即可. 再例如: 至于配置props,参见源码https://github.com/ElemeFE/el ...
- python3 sys.path
wadmin@ansible-test:~/python$ python3Python 3.6.7rc1 (default, Sep 27 2018, 09:51:25) [GCC 8.2.0] on ...
- php中print、echo、print_r、var_dump的区别
echo,print,print_r,var_dump区别 print只能接收一个字符串:print有返回值1(可在表达式中使用) e.g print 'string 1' e.g if($exp & ...
- 在Vuex使用 以及 dispatch和commit来调用mutations的区别
main.js中 import Vuex from 'vuex' Vue.use(vuex); const store = new Vuex.store({ state: { nickName: &q ...
- mysql并发更新
mysql并发更新 常见方案 乐观锁 select * from tab1 where id = ?; update tab1 set col1 = ? where id = ? and versio ...