08 2017 档案
摘要:直接上代码: 有个地方值得注意: <img /> 、<br /> 、<hr /> 没有内容的HTML元素被称为空元素,空元素是在开始标签中被关闭的。 效果图: 上述关于body背景颜色、h1对齐方式的设置方法已经过时,应该通过style进行设置。
阅读全文
摘要:df -h, --human-readable du -h, --human-readable -s, --summarize
阅读全文
摘要:python脚本如何调用Java的jar文件呢? HelloWorld.java javacaller.py 输出: b'hello world\n' <class 'bytes'>decode: hello world <class 'str'>b'LOGAN' <class 'bytes'>de
阅读全文
摘要:今天发现,使用redis-py从redis中获取的数据竟然是加密的。 输出: result: b'value1'result type: <class 'bytes'> result_decoded: value1result_decoded type: <class 'str'> result_s
阅读全文
摘要:with 语句适用于对资源进行访问的场合,确保不管使用过程中是否发生异常都会执行必要的“清理”操作,释放资源。 比如文件使用后自动关闭、线程中锁的自动获取和释放等。 运行机制 等价于 VAR对应一个上下文管理器(context manager)。 上下文管理器 实现了__enter__()和__ex
阅读全文
摘要:用Python实现一个http server python post json的两种方法:
阅读全文
摘要:先上一张镇楼图 再来一个demo PS: http://www.cplusplus.com/reference/cstdio/sscanf/
阅读全文
摘要:字符串处理绝对是任何一门语言的重点。 str.partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator,
阅读全文
摘要:decorator(装饰器)绝对是Python学习道路上的一个拦路虎。想要理解它,先看两个概念。 nested function(内嵌函数) 类似于函数局部变量,内嵌函数就是函数的局部函数。 Python的内嵌函数有个特点,它可以访问自身作用域外围的变量。 内嵌函数is_even可以直接访问外围参数
阅读全文
摘要:time 输出: timestamp:1505887820.714079, type: <class 'float'>localtime: time.struct_time(tm_year=2017, tm_mon=9, tm_mday=20, tm_hour=14, tm_min=10, tm_s
阅读全文
摘要:find是一个使用非常频繁的命令。 基于文件时间的查找 Linux下的每个文件有三种时间戳 atime,access time mtime,modify time, 文件内容的修改 ctime,change time,文件权限或属性的修改 find的一个重要参数: -exec 对于每个匹配的文件,{
阅读全文