configparse模块和hashlib模块
2024-10-20 08:41:27
# 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())
最新文章
- opencv在图像显示中文
- 我喜欢ASP.NET的MVC因为它牛逼的9大理由(转载)
- TaggingJS – 可以灵活定制的 jQuery 标签系统插件
- 简单的angular表单验证指令
- Linux(Ubuntu) 和 Python 常用命令
- php 函数preg_match、preg_match_all ,以及正则表达式规则
- [Unity3D]开发视图中的标记 - Gizmos
- VNC的安装与配置
- 【译】 AWK教程指南 4通过文本内容和对比选择指定的记录
- objective-c 加号 减号 - +
- 转:PHP 使用ZipArchive压缩文件并下载
- HttpClient工具类
- Alisha’s Party(队列)
- 利用Ihttpmodel实现网站缓存,解决Server.Transfer 直接输出HTML源代码的问题
- iOS 错误及解决汇总
- GitLab简单使用
- ES6-LET,变量提升,函数提升
- [No0000C7]windows 10桌面切换快捷键,win10
- Oracle 11.2.0.4.0 Dataguard部署和日常维护(5)-Datauard 主备切换和故障转移篇
- ==和is
热门文章
- 使用JS调用手机本地摄像头或者相册图片识别二维码/条形码
- flask --- 02. 路由, 初始化配置,蓝图
- sql server 查询某个表被哪些存储过程调用
- (转载)Unity UGUI鼠标点击UI不受影响方法IsPointerOverGameObject
- Oracle三个配置文件详解
- eclipse中如何在当前工程中查找一个字符串
- linux使用代理进行apt安装 以 nord 为例
- 通过RequestContextHolder直接获取HttpServletRequest对象
- pytoch word_language_model 代码阅读
- [hdu P4114] Disney's FastPass