摘要: 0.题目如下: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1 阅读全文
posted @ 2017-09-21 13:08 人生入戏 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 0.题目如下: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? 1.先理解什 阅读全文
posted @ 2017-09-20 13:17 人生入戏 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 在当前目录 下生成shelve_test.bak shelve_test.dat shelve_test.dir,保存在这几个目录下 程序读的结果如下: 阅读全文
posted @ 2017-08-14 21:53 人生入戏 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 练习题1. 请使用python, 对下面的函数进行处理, 在函数被调用时打印耗时详情 答案: 用到了装饰器,一个很简单的装饰器 贴出代码如下: 运行结果: 阅读全文
posted @ 2017-08-13 22:12 人生入戏 阅读(631) 评论(0) 推荐(0) 编辑
摘要: 目的就是将脚本执行的根目录加入环境变量。 阅读全文
posted @ 2017-08-13 21:06 人生入戏 阅读(675) 评论(0) 推荐(0) 编辑
摘要: json序列化和json反序列化 pickle序列化和反序列化 JSON和pickle模块的区别 1、JSON只能处理基本数据类型。pickle能处理所有Python的数据类型。 2、JSON用于各种语言之间的字符转换。pickle用于Python程序对象的持久化或者Python程序间对象网络传输, 阅读全文
posted @ 2017-08-13 20:19 人生入戏 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 这叫协程,又叫微线程。 运行结果如下: 阅读全文
posted @ 2017-08-13 14:52 人生入戏 阅读(263) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = '人生入戏' user = "admin" passwd = "123456" def auth(auth_type): #print("auth_type:",auth_type) def out_wrapper(func): #print("... 阅读全文
posted @ 2017-08-12 22:26 人生入戏 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 运行结果如下: 阅读全文
posted @ 2017-08-11 15:12 人生入戏 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 列表注意细节: 1.list.clear():将列表中成员清空(与del list区别开) 2.list.copy():复制一份相同的列表(浅COPY,只复制列表第一层) 3.如果两个列表相等,如list1 = list2,list1发生改变,list2也会发生改变,不受程序执行的顺序的影响。区别于 阅读全文
posted @ 2017-08-09 18:39 人生入戏 阅读(225) 评论(0) 推荐(0) 编辑