zoukankan      html  css  js  c++  java
  • https://blog.csdn.net/qq_40674583/article/details/81940974

    Python常用模块大全(总结)
    hashlib,md5模块:
    
    hashlib.md5(‘md5_str‘).hexdigest() 对指定字符串md5加密
    md5.md5(‘md5_str‘).hexdigest() 对指定字符串md5加密
    
    
    Python常用模块大全(总结)
    random模块:
    
    random.random() 产生0-1的随机浮点数
    random.uniform(a, b) 产生指定范围内的随机浮点数
    random.randint(a, b) 产生指定范围内的随机整数
    random.randrange([start], stop[, step]) 从一个指定步长的集合中产生随机数
    random.choice(sequence) 从序列中产生一个随机数
    random.shuffle(x[, random]) 将一个列表中的元素打乱
    random.sample(sequence, k) 从序列中随机获取指定长度的片断
    
    types模块:
    
    保存了所有数据类型名称。
    if type(‘1111‘) == types.StringType:
    MySQLdb模块:
    MySQLdb.get_client_info() 获取API版本
    MySQLdb.Binary(‘string‘) 转为二进制数据形式
    MySQLdb.escape_string(‘str‘) 针对mysql的字符转义函数
    MySQLdb.DateFromTicks(1395842548) 把时间戳转为datetime.date对象实例
    MySQLdb.TimestampFromTicks(1395842548) 把时间戳转为datetime.datetime对象实例
    MySQLdb.string_literal(‘str‘) 字符转义
    MySQLdb.cursor()游标对象上的方法:《python核心编程》P624
    
    atexit模块:
    
    atexit.register(fun,args,args2..) 注册函数func,在解析器退出前调用该函数
    

      

    --------------------- 作者:changaspl 来源:CSDN 原文:https://blog.csdn.net/qq_40674583/article/details/81940974 版权声明:本文为博主原创文章,转载请附上博文链接!

      

  • 相关阅读:
    cors解决跨域
    神经网络和keras
    tensorflow笔记
    5.聚类算法-kmeans
    4.回归类算法-目标值连续型
    3.分类算法-目标值离散型
    Phaser.js开发小游戏之洋葱头摘星星
    VS Code 插件之 vscode-debug-visualizer
    Phaser.js开发小游戏之Phaser.js介绍
    微信小程序中写threejs系列之 threejs-miniprogram
  • 原文地址:https://www.cnblogs.com/heluobing/p/10963830.html
Copyright © 2011-2022 走看看