摘要: 一次性跳出多层循环; (方法一:)break_flag = Falsefor i in range(5): print("爷爷层:",i) for i in range(5): if i == 3: break_flag = True break for i in range(10): print( 阅读全文
posted @ 2017-07-28 08:23 sanithzou 阅读(108) 评论(0) 推荐(0) 编辑
摘要: KEY菜单用while循环:好处是输入有误自动再次循环;如果用for循环key 需要判断几个其他情况的条件; value处用for循环 break_flag用于熟悉使用; 三级菜单优化:不同之处:最后一级是字典,(原最后一级是数组;) 购物车优化: 阅读全文
posted @ 2017-07-28 07:52 sanithzou 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 第二章课后作业: import getpassusername = input("username:")password = getpass.getpass("password:")print (username,password)name = "alex" 引号,代表字符串;print(type( 阅读全文
posted @ 2017-07-24 17:15 sanithzou 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #import getpass 1、猜年龄,可以让用户最多猜三次; #每隔三次,问他一下,还想不想继续玩;y,n 待完善! 阅读全文
posted @ 2017-07-24 08:47 sanithzou 阅读(138) 评论(0) 推荐(0) 编辑
摘要: nginx 配置文件:/etc/nginx/sites-availbale/default 集群搭建 1、部署nginx反向代理三个web服务,调度算法使用加权轮询; Answer: (ubuntu位置:/etc/nginx/nginx.conf) http { upstream pythonweb 阅读全文
posted @ 2017-07-23 16:11 sanithzou 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1、lsblk 系统硬盘 2、符号^ ^2.1、取以^开头的行: grep '^s' /etc/passwd2.2、以。。。结尾的 grep 'bash$' /etc/passwd2.3、'.' 表示任意一个字符;grep '^b.n' /etc/passwd2.4、 * 以*左边开头匹配,*左边有 阅读全文
posted @ 2017-07-06 15:40 sanithzou 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 1、函数命令高于内置命令:fucnction cd () { echo 123; }cd123取消CD命令:unset cd 2、read命令:read -p 'pls input your hostname:' name#echo $name取name值:echo $name 3、函数使用: # 阅读全文
posted @ 2017-07-05 10:19 sanithzou 阅读(132) 评论(0) 推荐(0) 编辑