作业---修改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':{ ...
随机推荐
- ubuntu安装ssh-service出现无法依赖的解决
(1)首先先确认下ubuntu系统是否已经安装ssh(通常ubuntu中默认是安装的) 通过命令进行查看:$dpkg -l | grep ssh这里我们可以看到,系统显示已经安装了openssh-cl ...
- 运维ps语法---》ps、pstree、top、htop、nice、renice、kill、ulimit、w 和 who 和 whoami、pgrep、fg 和 bg、ipcs
Linux中的ps命令是Process Status的缩写.ps命令用来列出系统中当前运行的那些进程.ps命令列出的是当前那些进程的快照,就是执行ps命令的那个时刻的那些进程,如果想要动态的显示进程信 ...
- 微信小程序 - app.json配置解析
{ "pages": [ "pages/index/index", "pages/logs/logs", "pages/login ...
- linux 入门学习
一.命令 1.命令提示符 [root@localhost ~]# [] :提示符的分隔符,无特殊含义: root:当前的登录用户: @:分隔符,无特殊含义: localhost:当前主机名(完整名称: ...
- Java判断字符串是否有重复
检测是否重复: public static boolean checkDifferent(String iniString) { boolean isbool = false; char[] ch ...
- Ubuntu软件中心闪退
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install --reinstall software-center
- 浅谈jquery事件命名空间
什么是jquery的事件命名空间? 先看如下简单代码: $("#btn").on("click.name1.name2",function(){ console ...
- Ubuntu和Linux的区别
大家听别人介绍自己的Ubuntu时,会听到“我的操作系统是Linux的”.其实,这样介绍是缺乏严谨性滴.我们只要知道两点,基本上就搞清楚Linux和Ubuntu的关系: 1. 严格来说,Linu ...
- Visual C++ 6.0中互换两个数字
就好比如两杯水,需要三个杯子将这两杯水互换.互换数字就要用一个中间变量. # include <stdio.h> int main(void) { int i; int j; int k; ...
- spring boot 项目部署在阿里云上
装jdk, 然后 nohup java -jar xxxx.jar> system.log 2>&1 & lsof -i:9999 kill -9 1234