
python
Frank_07
这个作者很懒,什么都没留下…
展开
-
日志、异常、上下文
import datetimeimport tracebackimport logginglogger=logginglogger.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',原创 2017-11-08 14:33:12 · 599 阅读 · 0 评论 -
redis去重
import hashlibimport redis"""利用redis的集合不允许添加重复元素来进行去重"""import configparserconfig = configparser.ConfigParser()config.read('db_conf')host = config['redis']['host']port = config.getint('redis', 'p原创 2017-11-09 10:00:38 · 4688 阅读 · 0 评论 -
sorted排序
l1=[('d',1),('b',3),('c',8),('a',2)]l2=sorted(l1)l2#[('a', 2), ('b', 3), ('c', 8), ('d', 1)]l3=sorted(l1,key=lambda x:x[1])l3#[('d', 1), ('a', 2), ('b', 3), ('c', 8)]l4=sorted(l1,key=lambda x:x[1]原创 2017-11-10 09:54:03 · 429 阅读 · 0 评论 -
rabbitMQ-python
python之消息队列原创 2017-11-02 10:55:32 · 285 阅读 · 0 评论 -
ascii(hex)/aes_ecb
针对密钥和密文明文都是ascii(hex)形式进行aes_ecb加密和解密import binasciifrom cryptography.hazmat.backends import default_backendfrom cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modesfrom cryptogra原创 2017-11-24 15:20:01 · 4107 阅读 · 0 评论 -
加密解密之aes_cbc
原创 2018-05-09 18:32:53 · 1002 阅读 · 0 评论 -
python生成图片验证码
import randomimport stringfrom PIL import Image, ImageFont, ImageDrawimport numpy as npimport mathfrom scipy import miscimport os#字符集characters = string.digits + string.ascii_lettersclass ...原创 2018-05-23 17:15:26 · 5961 阅读 · 1 评论