随笔分类 - python
摘要:# -*- coding: utf-8 -*- import traceback from os.path import basename import smtplib from email.header import Header from email.mime.application impor
阅读全文
摘要:def clock(func): """ 计时装饰器 :param func: :return: """ @functools.wraps(func) def deco(*args, **kwargs): start_time = time.time() result = func(*args, *
阅读全文
摘要:# -*- coding: UTF-8 -*- class Dict2Obj(dict): def __init__(self, *args, **kwargs): super(Dict2Obj, self).__init__(*args, **kwargs) def __getattr__(sel
阅读全文
摘要:yield,使用 yield 的函数被称为生成器(generator),跟普通函数不同的是,生成器是一个返回迭代器的函数,只能用于迭代操作,在调用生成器运行的过程中,每次遇到 yield 时函数会暂停并保存当前所有的运行信息,返回 yield 的值, 并在下一次执行 next() 方法时从当前位置继
阅读全文
摘要:filter() 函数用于过滤序列,返回由符合条件元素组成的新列表。接收两个参数,第一个为函数,第二个为序列,序列的每个元素作为参数传递给函数进行判断,然后返回 True 或 False,最后返回迭代器对象 filter(function, iterable) def func(n): return
阅读全文
摘要:##正则表达式中常用的字符含义 普通字符 | 匹配自身 | | | . | 匹配任意除换行符"\n"外的字符 \ | 转义字符,使后一个字符改变原来的意思 | 匹配前一个字符0或多次 | 匹配前一个字符1次或无限次 ? | 匹配一个字符0次或1次 ^ | 匹配字符串开头。在多行模式中匹配每一行的开头
阅读全文
摘要:显示百分比 import sys import time n = 1 while n <= 100: sys.stdout.write('{}{:.0f}%\r'.format('*' * n, float(n / 100) * 100)) if n == 100: sys.stdout.write
阅读全文
摘要:显示百分比 import sys import time n = 1 while n <= 100: sys.stdout.write('{}{:.0f}%\r'.format('*' * n, float(n / 100) * 100)) if n == 100: sys.stdout.write
阅读全文
摘要:import bottle from bottle import template, Bottle, static_file, request, redirect bottle.TEMPLATE_PATH.append("./templates/") # 指定模板目录 root = Bottle()
阅读全文
摘要:python copy(浅拷贝)和deepcopy(深拷贝) copy:只拷贝最外层数据,不拷贝里面的子层数据,即子层数据是共享的,不管修改源对象还是拷贝对象的子层数据,源数据和拷贝数据都会被修改 deepcopy:拷贝全部数据,包含所有子层 浅拷贝copy #coding:utf-8 list1
阅读全文
摘要:背景:需要使用pyqt5,做一个图形化的界面,打包成exe提供给他人使用 学习主要参考以下: https://zmister.com/archives/169.html https://github.com/maicss/PyQt5-Chinese-tutorial/blob/master/SUMM
阅读全文
摘要:http://pic.netbian.com/uploads/allimg/200711/223207-159447792741da.jpg
阅读全文

浙公网安备 33010602011771号