configparse模块和hashlib模块
# import configparser
#
# config = configparser.ConfigParser() #config = {} # config['DEFAULT'] = {'ServerAliveInterval':'45',
# 'Compression':'yes',
# 'CompressionLevel':'9'}
#
# config['bitbucket.org'] = {}
# config['bitbucket.org']['User'] = 'hg'
#
# config['topsecret.server.com'] = {}
# topsecret = config['topsecret.server.com']
# topsecret['Host Port'] = '50022'
# topsecret['ForwardX11'] = 'no'
# config['DEFAULT']['ForwardX11'] = 'yes'
#
#
# with open('example.ini','w') as f:
# config.write(f) import configparser config = configparser.ConfigParser() #config = {}
config.read('example.ini') # 查
# print(config.sections())
# print('bytehong.com' in config)
# print(config['bitbucket.org']['User'])
# print(config['DEFAULT']['Compression'])
# print(config['topsecret.server.com']['ForwardX11']) # for key in config['bitbucket.org']:
# print(key) # print(config.options('bitbucket.org'))
# print(config.items('bitbucket.org'))
# print(config.get('bitbucket.org','compression')) # 增
# config.add_section('hello')
# config.set('hello','k1','123') # 删
# config.remove_section('topsecret.server.com')
# config.remove_option('bitbucket.org','User') config.write(open('test.txt','w'))
# 用于加密相关的操作,主要提sha1,sha224,sha384,sha512,md5算法
# 算法越复杂,消耗的时间越多
import hashlib # obj = hashlib.md5('sb'.encode('utf-8')) obj = hashlib.md5() # obj.update("hello".encode('utf-8'))
# print(obj.hexdigest()) # obj.update('helloroot'.encode('utf-8'))
# print(obj.hexdigest())
configparse模块和hashlib模块的更多相关文章
- hmac模块和hashlib模块
hmac模块和hashlib模块 一.hash是什么 hash是一种算法(Python3.版本里使用hashlib模块代替了md5模块和sha模块,主要提供 SHA1.SHA224.SHA256. ...
- 包、logging模块、hashlib模块、openpyxl模块、深浅拷贝
包.logging模块.hashlib模块.openpyxl模块.深浅拷贝 一.包 1.模块与包 模块的三种来源: 1.内置的 2.第三方的 3.自定义的 模块的四种表现形式: 1.py文件 2.共享 ...
- [xml模块、hashlib模块、subprocess模块、os与sys模块、configparser模块]
[xml模块.hashlib模块.subprocess模块.os与sys模块.configparser模块] xml模块 XML:全称 可扩展标记语言,为了能够在不同的平台间继续数据的交换,使交换的数 ...
- Python模块之hashlib模块、logging模块
一.hashlib模块 hashlib模块介绍:hashlib这个模块提供了摘要算法,例如 MD5.hsa1 摘要算法又称为哈希算法,它是通过一个函数,把任意长度的数据转换为一个长度固定的数据串,这个 ...
- 19 python初学(os 模块,sys 模块,hashlib 模块)
os 模块: # _author: lily # _date: 2019/1/13 import os print(os.getcwd()) # 得到当前的工作目录 # print(os.chdir( ...
- re模块、hashlib模块
一.re模块 1.什么是正则? 正则就是用一系列具有特殊含义的字符组成一套规则,该规则用来描述具有某一特征的字符串,正则就是用来去一个大的字符串中匹配出符合规则的子字符串 2.为何要用正则? 用户注册 ...
- day5模块学习--hashlib模块
hashlib模块 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度 ...
- 模块讲解----hashlib模块(加密)
作用 用于加密相关的操作,代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法 语法 import hashlib #md5 ...
- 模块—— 序列化模块、random模块、os模块 、 sys模块、hashlib模块、collections模块
今天我们来说说Python中的模块: 第三方模块 可以下载/安装/使用 第一步:将pip.exe 所在的目录添加到环境变量中第二步:输入pip第三步:pip install 要安装的模块名称 #pi ...
- python 无序模块,hashlib模块
无序模块什么是无序模块,将字符串转化为十六进制的字符串类型,主要运用在网络编程中.1,json模块 1,用于网络传输,跨语言,可用的类型有 int str 列表-->元祖会变为列表 字典--&g ...
随机推荐
- Bugku-CTF之域名解析(听说把 flag.baidu.com 解析到123.206.87.240 就能拿到flag)
Day 7 域名解析 50 听说把 flag.baidu.com 解析到123.206.87.240 就能拿到flag
- Bootstrap 可视化HTML编辑器,summernote
Bootstrap 可视化HTML编辑器之summernote,用其官网上的介绍就是"Super Simple WYSIWYG editor",不过在我看来,与bootstrap中 ...
- Python入门 io篇
简单demo with open('d:/pydemo/pythonStart/fun1.py', 'r') as f: #print(f.read()) while True: line = f.r ...
- C# Array 基本数据类型数组的基类 传参问题
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- vue-先渲染dom载执行js
价格判断v-if=“dataList”有数据的时候才渲染
- UGUI之导入图片之前自动设置图片打包的 tag
之前一直在用的是NGUI,最近不知怎么突然兴趣来潮,想学习一下UGUI,毕竟,现在纵观Unity的市场,完全是UGUI的天下,NGUI已经渐渐退隐江湖,哈哈哈... 先来记录下,在图片资源导入到Uni ...
- 【SQL Server备份恢复】维护计划实现备份:每周数据库完整备份、每天差异备份、每小时日志备份
在数据库管理中,数据库备份是非常重要的. 通过维护计划向导,可以很方便的完成数据库备份. 下面的例子说明了如何实现数据库的备份,具体的备份策略是:每周日一次完整备份.每天差异备份(除周日外).每小时日 ...
- ios10兼容问题
var lastTouchEnd = 0; document.addEventListener('touchend', function(event) { var now = (new Date()) ...
- DataSet select 的使用
1) Select()——获取所有 System.Data.DataRow 对象的数组. 2) Select(string filterExpression)——按照主键顺序(如果没有主键,则按照添加 ...
- redis 版的 hello world
为 redis 添加一个命令,效果如下图: 在 Server.h 中加入命令处理函数的声明: void meCommand(client *c); 在 Server.c 的命令表中加入: struct ...