python
请叫我诗书
这个作者很懒,什么都没留下…
展开
-
K8S运行基于微服务的应用程序(一) 创建docker镜像
K8S运行基于微服务的应用程序(一) 创建docker镜像本文为 三小时攻克 Kubernetes! 的学习实践记录一、为前端React应用创建镜像安装Node.js 和 npm进入 /sa-frontend 目录$ npm install$ npm run build在目录下得到/build文件夹,创建DockerfileFROM nginxCOPY build /usr/share/nginx/html创建镜像$ sudo docker build -t sentiment:原创 2020-05-15 13:52:28 · 678 阅读 · 0 评论 -
python map函数
map() 会根据提供的函数对指定序列做映射。第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表map(function, iterable, ...)python2中返回列表,python3中返回迭代器>>> a[range(0, 5)]>>> b[range(0, 6)...原创 2018-03-27 15:14:06 · 580 阅读 · 0 评论 -
python的一些操作
对于两个集合A、B,A.difference(B)表示在集合A中存在,但是B中不存在的元素>>> A=set(range(5))>>> B=set(range(2,7))>>> A,B({0, 1, 2, 3, 4}, {2, 3, 4, 5, 6})>>> A.difference(B){0, 1}differen...转载 2018-03-24 12:28:07 · 122 阅读 · 0 评论 -
python中的bisect模块
1. bisectbisect.bisect(seq, item, lo = 0, hi =len(list_name))在有序列表 seq 中查找 item 的位置,并且返回其 索引 (index),使得插入item后序列依然保持有序有两个可选参数 lo 和 hi 来缩小搜索范围,lo 的默认值为 0 ,hi 的默认值为序列的长度。直接使用 insort 插入比先使用 bis原创 2017-12-14 23:16:20 · 10286 阅读 · 1 评论 -
python中的collestions模块
看到collections.namedtuple()函数,顺便学习一下1.namedtuple创建一个具名元组子类,可以使用名字(属性)来引用元组中的值>>> import collections>>> node = collections.namedtuple('position',['x','y'])>>> node>>> p = node(1,5)>>> ppos原创 2017-12-14 16:25:56 · 575 阅读 · 0 评论 -
python中的str.join()
可以使用str字符串中的字符来连接join()中的list>>> a['H', 'e', 'llo']>>> b=''.join(a)>>> b'Hello'>>> c='-'.join(a)>>> c'H-e-llo'>>> d='*'>>> e=d.join(a)>>> e'H*e*llo'原创 2017-11-08 16:59:58 · 8931 阅读 · 1 评论 -
python中enumerate
使用两个变量返回索引和参数>>> a['H', 'e', 'llo']>>> for i,j in enumerate(a): i,j (0, 'H')(1, 'e')(2, 'llo')原创 2017-11-08 17:03:11 · 173 阅读 · 0 评论 -
python challenge 7
进入页面,得到线索:it's in the air. look at the letters.看字母,O2氧气的英文是oxygen,进入页面import urllib.requestfile = open('oxygen.png', 'wb') im_data = urllib.request.urlopen('http://www.pythonchallenge.co原创 2017-12-19 22:46:36 · 858 阅读 · 0 评论 -
python challenge 0~6
知道了一个小游戏 http://www.pythonchallenge.com/ 尝试一下python challenge原创 2017-12-15 16:54:12 · 790 阅读 · 0 评论