摘要: #!/usr/bin/env python # -*- coding: utf-8 -*- ''' 该日志类可以把不同级别的日志输出到不同的日志文件中 ''' import os import sys import time import logging import inspect handlers = {logging.NOTSET:"/tmp/TNLOG-notset.log", ... 阅读全文
posted @ 2018-05-24 10:20 飞奔的小水牛 阅读(614) 评论(0) 推荐(0) 编辑
摘要: #!/bin/env python # -*- coding:utf-8 -*- ''' 实现能计算类似 1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2))公式 ''' import re def cal_mini_exp(mini): #计算40/5 2*... 阅读全文
posted @ 2018-05-19 14:55 飞奔的小水牛 阅读(332) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/Eva-J/articles/7228075.html#_label15 阅读全文
posted @ 2018-05-10 22:12 飞奔的小水牛 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 1、time模块 输出: 2、OS模块 3、random 阅读全文
posted @ 2018-05-10 22:09 飞奔的小水牛 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 要求:实现模拟sql登录,增删改查功能 阅读全文
posted @ 2018-05-10 22:04 飞奔的小水牛 阅读(217) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/Eva-J/articles/7206498.html 阅读全文
posted @ 2018-05-06 10:48 飞奔的小水牛 阅读(81) 评论(0) 推荐(0) 编辑
摘要: https://www.zhihu.com/question/20829330 阅读全文
posted @ 2018-05-05 19:09 飞奔的小水牛 阅读(77) 评论(0) 推荐(0) 编辑
摘要: # 面试题 def demo(): for i in range(4): yield i g=demo() g1=(i for i in g) g2=(i for i in g1) print(list(g1)) print(list(g2)) 结果: [0, 1, 2, 3] [] def add(n,i): return n+i def te... 阅读全文
posted @ 2018-04-25 20:48 飞奔的小水牛 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 一、装饰器 装饰器本质上是一个python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象。它经常用于有切面需求的场景,比如:插入日志、性能测试事务处理、缓存、权限校验等场景。装饰器是解决这类问题的绝佳设计,有了装饰器,我们就可以抽离大量与函数功能本身 阅读全文
posted @ 2018-04-24 23:27 飞奔的小水牛 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 一、python文件操作 文件操作基本流程: 计算机系统分为:计算机硬件,操作系统,应用程序三部分。 我们用python或其他语言编写的应用程序若想要把数据永久保存下来,必须要保存于硬盘中,这就涉及到应用程序要操作硬件,众所周知,应用程序是无法直接操作硬件的,这就用到了操作系统。操作系统把复杂的硬件 阅读全文
posted @ 2018-04-24 23:09 飞奔的小水牛 阅读(156) 评论(0) 推荐(0) 编辑