摘要: 1 import random 2 3 def roll_dice(numbers = 3,points = None): 4 print('----- 摇骰子 -----') 5 if points is None: 6 points = [] 7 while numbers > 0: 8 point = random.randrange(1,7) 9 ... 阅读全文
posted @ 2018-04-08 09:31 Leonardo-li 阅读(497) 评论(0) 推荐(0) 编辑
摘要: import random def drawBoard(board): # 打印棋盘 # "board"是长度为10的列表,为了方便输入,忽略第一个元素board[0] print('\n\n\n\n') print('\t\t\t┌--─┬--─┬--─┐') print('\t\t\t│'+b... 阅读全文
posted @ 2018-04-08 09:30 Leonardo-li 阅读(542) 评论(0) 推荐(0) 编辑
摘要: 字典与字符串操作: 1.自定义函数 a=123 def jia(a): a+=10 print(a) jia(a) print(a) 2.字典的用法 dict_a={'9':'nine','7':'serven'} def zidian(a,b): dict_a[a]=b zidian('5','five') print(dict_a) 3.get()函数: ... 阅读全文
posted @ 2018-04-08 09:27 Leonardo-li 阅读(741) 评论(0) 推荐(0) 编辑
摘要: 1.首先修改yum源,安装最新版的docker. (1)国外yum源。 vim yum.repo [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled 阅读全文
posted @ 2018-04-08 09:17 Leonardo-li 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 综合架构图: 综合架构详解: 详细总结: 公司第一大环境(生产环境): 1.整个web的访问过程其实就是数据流怎么处理的。 2.访问请求分为:动态 静态请求 3.代理:分为 反向代理(reporxy) 和 集群代理 一般公司将反向代理服务器放到最外边。 4.消息列队:同步处理改为异步处理 5.CDN 阅读全文
posted @ 2018-04-08 09:08 Leonardo-li 阅读(15909) 评论(0) 推荐(0) 编辑
摘要: 1.首先更新pip3安装工具: pip3 install --upgrade pip 2.下载机器猫的原图 wget http://labfile.oss.aliyuncs.com/courses/370/ascii_dora.png 3.下载python的图像支持库pillow(PIL) pip3 install pillow 4.编辑文件(配置文件有附件) vim ascii.py ... 阅读全文
posted @ 2018-03-28 17:40 Leonardo-li 阅读(1127) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序:就是将列表里的混乱的整形或其他进行有效的排序。test1: num=list('2574') n=len(num) print(num) for i in range(0,n): for j in range(i+1,n): if num[i]>num[j]: #a>b c=num[j] #c=b ... 阅读全文
posted @ 2018-03-28 17:37 Leonardo-li 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 要求:通过定义一个列表,来插寻你输入的第N次的整形是多少。spam=[] n=int(input('输入多少次')) for i in range(0,n): spam.append(input('请输入第 '+ str(i+1)+ '次')) print('确认你的内容:') s=input() if s=='yes' or s=='y' or s=='Y': print(spa... 阅读全文
posted @ 2018-03-28 17:32 Leonardo-li 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 元素列表:1在列表最后一位添加元素>>> number=[1,2,3,4,5]>>> number.append(6)>>> print(number)[1, 2, 3, 4, 5, 6]>>> number[1, 2, 3, 4, 5, 6]>>> number.extend([7,8,9])>> 阅读全文
posted @ 2018-03-28 17:22 Leonardo-li 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 1.random模块介绍通过模块参数的调用,可以随机生成不同的整形,浮点型,字符等 2.random参数的解释:随机整数random.randint(0,99)随机偶数random.randrange(0,101,2)随机浮点数random.random()/random.uniform(1,10) 阅读全文
posted @ 2018-03-28 17:16 Leonardo-li 阅读(285) 评论(0) 推荐(0) 编辑