摘要: import time def progress(precent,w=50): if precent<1: precent=1 show_str=('[%%-%ds]' %w)%("#"*int(precent*w )) print('\r%s %d%%'%(show_str,int(precent*100)),end="") recv_size=... 阅读全文
posted @ 2018-01-18 17:51 银鑫 阅读(408) 评论(0) 推荐(0)
摘要: import random def make_code(n): res="" for i in range(n): s1=str(random.randint(1,9)) s2=chr(random.randint(65,90)) res+=random.choice([s1,s2]) return res pri... 阅读全文
posted @ 2018-01-18 17:51 银鑫 阅读(116) 评论(0) 推荐(0)
摘要: ConfigParser简介 ConfigParser 是用来读取配置文件的包。配置文件的格式如下:中括号“[ ]”内包含的为section。section 下面为类似于key-value 的配置内容。 2:ConfigParser的常用方法 2:获取指定section中的option。也就是获取i 阅读全文
posted @ 2018-01-18 17:28 银鑫 阅读(200) 评论(0) 推荐(0)
摘要: 本章节我们将为大家介绍如何使用 Python 语言来编码和解码 JSON 对象。 JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,易于人阅读和编写。 SON 函数 使用 JSON 函数需要导入 json 库:import json。 json.dumps 阅读全文
posted @ 2018-01-18 13:18 银鑫 阅读(182) 评论(0) 推荐(0)