会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
只记今朝笑
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
下一页
2018年9月6日
re正则匹配
摘要: import re#'(?P<name>...)' 分组匹配print(re.search("(?P<id>[0-9]+)","abc12345daf@34")) #返回一个对象print(re.search("(?P<id>[0-9]+)", "abc12345daf@34").groupdict
阅读全文
posted @ 2018-09-06 11:30 只记今朝笑
阅读(1860)
评论(0)
推荐(0)
2018年9月5日
hashlib、hmac
摘要: #hashlibimport hashlib#md5m = hashlib.md5()m.update(b"Hello")print(m.hexdigest()) #hexdigest十六进制加密m.update(b"It's me") #包含之前的Helloprint(m.hexdigest())
阅读全文
posted @ 2018-09-05 17:30 只记今朝笑
阅读(165)
评论(0)
推荐(0)
Dockerfile
摘要: FROM orangejyc/alpine-oraclejdk8:latestVOLUME /tmp #/var/lib/docker 下面随机创建一个目录挂载到容器的/tmpADD ./target/account-manager-0.0.1-SNAPSHOT.jar app.jar #如果不写绝
阅读全文
posted @ 2018-09-05 14:29 只记今朝笑
阅读(342)
评论(0)
推荐(0)
configparser配置文件处理
摘要: 创建一个configparser格式的文档:import configparserconfig = configparser.ConfigParser()config["DEFAULT"] = {'ServerAliveInterval': '45', 'Compression': 'yes', '
阅读全文
posted @ 2018-09-05 10:42 只记今朝笑
阅读(871)
评论(0)
推荐(0)
2018年9月4日
XML处理
摘要: xmltest.xml内容如下:
阅读全文
posted @ 2018-09-04 14:01 只记今朝笑
阅读(226)
评论(0)
推荐(0)
2018年8月30日
常用模块
摘要: time模块:时间相关的操作import timex = time.localtime()print(x)y = time.strftime("%Y-%m-%d %H:%M:%S",x)print(y)z = time.strptime(y,"%Y-%m-%d %H:%M:%S")print(z)这
阅读全文
posted @ 2018-08-30 11:06 只记今朝笑
阅读(125)
评论(0)
推荐(0)
2018年8月27日
内存地址 id
摘要: <function b at 0x0000000001E84BF8><function b at 0x0000000001E84BF8>32001016 把print(c)得到的结果转换成10进制,就和print(id(c))的结果一样了;
阅读全文
posted @ 2018-08-27 17:36 只记今朝笑
阅读(298)
评论(0)
推荐(0)
序列化、持久化
摘要: 通过将对象序列化可以将其存储在变量或者文件中,可以保存当时对象的状态,实现其生命周期的延长。并且需要时可以再次将这个对象读取出来。Python中有几个常用模块可实现这一功能。 json模块: 序列化:
阅读全文
posted @ 2018-08-27 14:15 只记今朝笑
阅读(306)
评论(0)
推荐(0)
字典排序 sorted
摘要: a = {6:2,8:0,1:4,-5:6,99:11,4:22}print( sorted(a.items()) ) #默认安照key排序的print( sorted(a.items(),key=lambda x:x[1]) ) #按照value排序print(a )参考:http://www.r
阅读全文
posted @ 2018-08-27 11:27 只记今朝笑
阅读(784)
评论(0)
推荐(0)
字典 hash
摘要: 字典是按照hash存的,他会映射一个hash表,所以查找的时候根据一些算法会很快; 参考: https://harveyqing.gitbooks.io/python-read-and-write/content/python_advance/python_dict_implementation.h
阅读全文
posted @ 2018-08-27 11:01 只记今朝笑
阅读(259)
评论(0)
推荐(0)
上一页
1
2
3
4
下一页
公告