01 2018 档案
摘要:1:Python基础 Python介绍以及环境安装 1.1 Python基础之第一个Python程序 1.2 Python基础之数据类型,字符编码,文件处理 2:Python函数 2.1 Python函数之关于函数 2.2 Python函数之迭代器,生成器 2.3 Python函数之装饰器 2.4
阅读全文
摘要: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=...
阅读全文
摘要: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...
阅读全文
摘要:ConfigParser简介 ConfigParser 是用来读取配置文件的包。配置文件的格式如下:中括号“[ ]”内包含的为section。section 下面为类似于key-value 的配置内容。 2:ConfigParser的常用方法 2:获取指定section中的option。也就是获取i
阅读全文
摘要:本章节我们将为大家介绍如何使用 Python 语言来编码和解码 JSON 对象。 JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,易于人阅读和编写。 SON 函数 使用 JSON 函数需要导入 json 库:import json。 json.dumps
阅读全文
摘要:1:logging模块 import logging logging.debug('This is debug message') logging.info('This is info message') logging.warning('This is warning message') 屏幕上打
阅读全文
摘要:>>> L = [1,2,3]>>> [x**2 for x in L][1, 4, 9]>>> next(L)Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: 'list' object
阅读全文