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 ...
随机推荐
- org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'null' to required type 'double' for property 'band'; nested exception is org.springframework.core.convert.Con
本文为博主原创,未经允许不得转载: 先将异常粘贴出来: 20:37:26,909 ERROR [com.suning.fucdn.controller.ProductDataStaticsContro ...
- 【Visual Studio 扩展工具】如何在ComponentOne的DataTree中实现RightToLeft布局
概述 C1FlexGrid提供了创建轮廓树的功能,其中可以显示缩进结构,每个节点行旁边都有折叠/展开图标. 然后,用户可以展开和折叠轮廓以查看所需的细节级别. 为此,C1FlexGrid允许您使用其T ...
- 廖雪峰 JavaScript 学习笔记(判断、循环)
条件判断 固定格式:if () { ... } else { ... } ,else可选 1.多行条件判断,通常把else if连写在一起,来增加可读性 例子: var age = 3; if (a ...
- mybatis分页插件PagePlugin
查询的参数对象里面继承PageInfoWrapper类(也可以不继承这个类,但要保证查询参数对象里面必须要有一个PageInfo属性) 分页信息都在PageInfo这个类里,查询的时候,分页参数,填充 ...
- MySQL中的decimal
MySQL DECIMAL数据类型用于在数据库中存储精确的数值.我们经常将DECIMAL数据类型用于保留准确精确度的列,例如会计系统中的货币数据. 要定义数据类型为DECIMAL的列,请使用以下语法: ...
- 20190226_xlVba提取查新标题和关键词
Sub MainProc() Dim Sht As Worksheet Dim Wb As Workbook Set Wb = Application.ThisWorkbook Set Sht = W ...
- Expression的烦恼
var tar = Expression.Label(typeof(int)); var p1=Expression.Parameter(typeof(int), "a"); va ...
- python中mysql数据库的操作-sqlalchemy
MySQLdb支持python2.*,不支持3.* ,python3里面使用PyMySQL模块代替 python3里面如果有报错 django.core.exceptions.ImproperlyC ...
- 『TensorFlow』读书笔记_Word2Vec
由于暂时不会深入接触NLP相关领域,所以本章的内容就不过多涉及了,以后会进行学习,应该. Word2Vec又称Word Embeddings,中文称为"词向量"."词嵌入 ...
- js里获取页面高度和文档高度
$(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...