摘要:
1 import hashlib 2 obj = hashlib.sha256() 3 obj.update('admin'.encode('utf-8')) 4 print(obj.hexdigest()) 5 print(len(obj.hexdigest())) 6 输出: 7 8c6976e 阅读全文
posted @ 2020-03-05 16:32
竹石2020
阅读(123)
评论(0)
推荐(0)
摘要:
1 import configparser 2 3 config = configparser.ConfigParser() 4 config['DEFAULT'] = { 5 'ServerAliveInterval': 45, 6 'Compression': 'yes', 7 'Compres 阅读全文
posted @ 2020-03-05 12:28
竹石2020
阅读(149)
评论(0)
推荐(0)
摘要:
参数 调用logging.basicConfig() 函数进行设置配置 filename='' 设置保存日志的文件名字 filemode=' ' 设置写入日志的方式 format=' ' 指定handler使用的日志显示格式 %()s 字符串 %()d 数字类型 level=' ' 设置rootlo 阅读全文
posted @ 2020-03-04 22:59
竹石2020
阅读(166)
评论(0)
推荐(0)
摘要:
\d 匹配任何十进制数;它相当于类[0-9] \D 匹配任何非数字字符;它相当于类[^0-9] \s 匹配任何空白字符;它相当于类[\t\n\r\f\v] \S 匹配任何非空白字符;它相当于类[^\t\n\r\f\v] \w 匹配任何字母数字字符;它相当于类[a-zA-Z0-9_] \W 匹配任何非 阅读全文
posted @ 2020-03-04 20:43
竹石2020
阅读(316)
评论(0)
推荐(0)
摘要:
1 import re 2 3 num_one = '(98798465*5465+4654-5464*45616846+84654)' 4 print(eval(num_one)) 5 6 total = 0 7 print(num_one) 8 while True: 9 try: 10 a = 阅读全文
posted @ 2020-03-04 20:37
竹石2020
阅读(224)
评论(0)
推荐(0)
摘要:
正则表达式主要是进行模糊匹配 1、普通字符 完全匹配 2、元字符 ^ $ * + ? {} [] | \ . 通配符 什么都可以代替数字、字母等等 出来换行符\n 代表任意一个字符例如: 1 import re 2 a = 'sddfsaljhhxsdlkjfeojfk' 3 b = re.find 阅读全文
posted @ 2020-03-03 22:42
竹石2020
阅读(283)
评论(0)
推荐(0)
摘要:
1 import xml.etree.ElementTree as ET 2 3 tree = ET.parse('xmltest.xml') 4 root = tree.getroot() # 一个对象 5 print(root.tag) # 打印标签名 6 for country in root 阅读全文
posted @ 2020-03-03 18:26
竹石2020
阅读(140)
评论(0)
推荐(0)
摘要:
shelve将所有内容处理为字典 1 import shelve 2 f = shelve.open(r'abc') # 拿到句柄 3 f['name'] = {'name':'yumeng'} # 写入文件 4 f['name1'] = {'info':'liyulu','age':17} 5 f 阅读全文
posted @ 2020-03-03 10:42
竹石2020
阅读(95)
评论(0)
推荐(0)
摘要:
1 import json 2 a = {'name':'alex','age':27} 3 b = json.dumps(a) 4 print(b,type(b)) 5 a = 8 6 print(json.dumps(a),type(json.dumps(a))) 7 f = open('new 阅读全文
posted @ 2020-03-02 22:31
竹石2020
阅读(139)
评论(0)
推荐(0)
摘要:
1 import time 2 import sys # 可以在运行文件的时候添加参数 3 # 使用sys.argv 来调用参数 4 print(sys.path) # 返回模块的搜索路径,初始化时使用pythonpath环境变量的值 5 print(sys.platform) # 返回平台的信息 阅读全文
posted @ 2020-03-02 20:31
竹石2020
阅读(110)
评论(0)
推荐(0)
浙公网安备 33010602011771号