上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页
摘要: with 语句适用于对资源进行访问的场合,确保不管使用过程中是否发生异常都会执行必要的“清理”操作,释放资源。 比如文件使用后自动关闭、线程中锁的自动获取和释放等。 运行机制 等价于 VAR对应一个上下文管理器(context manager)。 上下文管理器 实现了__enter__()和__ex 阅读全文
posted @ 2017-08-08 21:44 Sawyer Ford 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 用Python实现一个http server python post json的两种方法: 阅读全文
posted @ 2017-08-07 20:51 Sawyer Ford 阅读(3868) 评论(0) 推荐(0) 编辑
摘要: 先上一张镇楼图 再来一个demo PS: http://www.cplusplus.com/reference/cstdio/sscanf/ 阅读全文
posted @ 2017-08-07 16:32 Sawyer Ford 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 字符串处理绝对是任何一门语言的重点。 str.partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, 阅读全文
posted @ 2017-08-06 12:04 Sawyer Ford 阅读(180) 评论(0) 推荐(0) 编辑
摘要: decorator(装饰器)绝对是Python学习道路上的一个拦路虎。想要理解它,先看两个概念。 nested function(内嵌函数) 类似于函数局部变量,内嵌函数就是函数的局部函数。 Python的内嵌函数有个特点,它可以访问自身作用域外围的变量。 内嵌函数is_even可以直接访问外围参数 阅读全文
posted @ 2017-08-05 15:08 Sawyer Ford 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-04 15:48 Sawyer Ford 阅读(215) 评论(0) 推荐(0) 编辑
摘要: find是一个使用非常频繁的命令。 基于文件时间的查找 Linux下的每个文件有三种时间戳 atime,access time mtime,modify time, 文件内容的修改 ctime,change time,文件权限或属性的修改 find的一个重要参数: -exec 对于每个匹配的文件,{ 阅读全文
posted @ 2017-08-02 09:34 Sawyer Ford 阅读(226) 评论(0) 推荐(0) 编辑
摘要: os是个常用的模块,必须熟练。 参考资料: https://docs.python.org/3/library/os.html How do I remove/delete a folder that is not empty with Python? 阅读全文
posted @ 2017-07-31 20:46 Sawyer Ford 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 总结下shell中的函数用法 阅读全文
posted @ 2017-07-31 09:53 Sawyer Ford 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 平时写脚本还没有用到过数组,暂时先记录下用法。 阅读全文
posted @ 2017-07-28 17:51 Sawyer Ford 阅读(172) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页