设为首页 加入收藏

TOP

Python-Day4 Python基础进阶之生成器/迭代器/装饰器/Json & pickle 数据序列化(四)
2017-09-30 17:40:05 】 浏览:7048
Tags:Python-Day4 Python 基础 进阶 成器 装饰 /Json pickle 数据 序列化
)) e.write(
'\n') f.close() if choose_input == 2: user_input=input("例如:www.newboy.org" "请输入要修改的内容:") user_input2=input("例如:www.newboy.com" "请输入修改后的内容:") f = open('haproxy.txt', encoding='utf-8') f_new=open("haproxybak.txt","w",encoding='utf-8') for lines in f: if user_input in lines: lines = lines.replace(user_input,user_input2) f_new.write(lines) f.close() f_new.close() print("修改完毕,请查看haproxybak.txt") if choose_input == 4: user_input=input("例如:www.oldboy.org" "请输入要删除的内容:") a = ("backend %s\n" % user_input) f = open('haproxy.txt', encoding='utf-8') f_new=open("haproxybak.txt","w",encoding='utf-8') for lines in f: if a in lines: lines = lines.replace(a,'') d = c + 1 elif d == c : lines = "" f_new.write(lines) c += 1 f.close() f_new.close() print("节点已删除,请查看haproxybak.txt") else: print("请输入正确序号!!!") 代码

 

夕阳斜照将酒馆招牌影子拖长,

矮胖的老板在柜台后面算着酒账,

客人们喝着麦酒看着舞台之上,

抱着琴的诗人正在懒懒吟唱:

“……当所有传奇写下第一个篇章

原来所谓英雄也和我们一样。


首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇HTTPResponse object — JSON obj.. 下一篇Python之路:堡垒机实例

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目