# 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模块的更多相关文章

  1. hmac模块和hashlib模块

    hmac模块和hashlib模块 一.hash是什么 ​ hash是一种算法(Python3.版本里使用hashlib模块代替了md5模块和sha模块,主要提供 SHA1.SHA224.SHA256. ...

  2. 包、logging模块、hashlib模块、openpyxl模块、深浅拷贝

    包.logging模块.hashlib模块.openpyxl模块.深浅拷贝 一.包 1.模块与包 模块的三种来源: 1.内置的 2.第三方的 3.自定义的 模块的四种表现形式: 1.py文件 2.共享 ...

  3. [xml模块、hashlib模块、subprocess模块、os与sys模块、configparser模块]

    [xml模块.hashlib模块.subprocess模块.os与sys模块.configparser模块] xml模块 XML:全称 可扩展标记语言,为了能够在不同的平台间继续数据的交换,使交换的数 ...

  4. Python模块之hashlib模块、logging模块

    一.hashlib模块 hashlib模块介绍:hashlib这个模块提供了摘要算法,例如 MD5.hsa1 摘要算法又称为哈希算法,它是通过一个函数,把任意长度的数据转换为一个长度固定的数据串,这个 ...

  5. 19 python初学(os 模块,sys 模块,hashlib 模块)

    os 模块: # _author: lily # _date: 2019/1/13 import os print(os.getcwd()) # 得到当前的工作目录 # print(os.chdir( ...

  6. re模块、hashlib模块

    一.re模块 1.什么是正则? 正则就是用一系列具有特殊含义的字符组成一套规则,该规则用来描述具有某一特征的字符串,正则就是用来去一个大的字符串中匹配出符合规则的子字符串 2.为何要用正则? 用户注册 ...

  7. day5模块学习--hashlib模块

    hashlib模块     Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度 ...

  8. 模块讲解----hashlib模块(加密)

    作用 用于加密相关的操作,代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法 语法 import hashlib #md5 ...

  9. 模块—— 序列化模块、random模块、os模块 、 sys模块、hashlib模块、collections模块

    今天我们来说说Python中的模块: 第三方模块 可以下载/安装/使用 第一步:将pip.exe 所在的目录添加到环境变量中第二步:输入pip第三步:pip install 要安装的模块名称  #pi ...

  10. python 无序模块,hashlib模块

    无序模块什么是无序模块,将字符串转化为十六进制的字符串类型,主要运用在网络编程中.1,json模块 1,用于网络传输,跨语言,可用的类型有 int str 列表-->元祖会变为列表 字典--&g ...

随机推荐

  1. 尚硅谷面试第一季-13git分支相关命令

    课堂重点:分支相关命令 实际应用-工作流程 实操命令及运行结果: 创建master分支并提交 git init git add . git commit -m "V1.0" git ...

  2. 复旦高等代数 II(17级)每周一题

    本学期将继续进行高等代数每周一题的活动.计划从第一教学周开始,到第十六教学周为止(根据法定节假日安排,中间个别周会适当地停止),每周的周末将公布1道思考题(共16道),供大家思考和解答.每周一题通过“ ...

  3. springboot日志配置

    默认情况下,spring boot使用的是LogBack日志系统.在spring-boot-starter-web和spring-boot-starter中都已经默认依赖了logging的工具包. 如 ...

  4. Delphi10.2 Tokyo试用(1)

    最近下载了Delphi10.2 Tokyo,试用了一下,感觉不错,尤其是针对Linux的开发,总算出来了,可以考虑把原来服务器重新编译成RedHat上使用了,免得客户一天到晚喊Windows不安全,要 ...

  5. 再谈git和github-深入理解-2

    github中的 sloc是什么意思? sloc: source lines of code: 代码行数, 源代码行. 要向仓库中 create file/upload file/edit file等 ...

  6. Machine Learning--week4 神经网络的基本概念

    之前的学习成果并不能解决复杂的非线性问题 Neural Networks Sigmoid(logistic) activation function: activation function is a ...

  7. Learning-Python【31】:操作系统基础知识

    什么是操作系统 计算机系统由硬件和软件两部分组成.操作系统(OS,Operating System)是配置在计算机硬件上的第一层软件,是对硬件系统的首次扩充.它在计算机系统中占据了特别重要的地位:而其 ...

  8. Linux下的串口调试工具——Xgcom

    Linux下的串口调试工具——Xgcom xgcom的下载网址:https://code.google.com/archive/p/xgcom/downloads (1)安装必须的库 apt-get ...

  9. 特效 左右滑动轮播图jQuery思路

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. gis和threejs的学习资料

    *********************************** 基础知识/名词 瓦片/矢量瓦片GeoJson - 绘制GeoJson看数据, geojson规范, 中文版 ********** ...