03 2018 档案

利用BeautifulSoup爬博客园的网址(待完善)
摘要:from urllib.request import urlopenfrom bs4 import BeautifulSoupimport reimport randomimport datetimepages = set()random.seed(datetime.datetime.now())d 阅读全文

posted @ 2018-03-28 15:14 Overtimer-加班哥 阅读(126) 评论(0) 推荐(0)

适用于python3的HTMLTestRunner,留着备用
摘要:"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this 阅读全文

posted @ 2018-03-26 14:21 Overtimer-加班哥 阅读(133) 评论(0) 推荐(0)

操作mysql
摘要:1、建立连接2、创建游标3、执行sql4、获取数据5、关闭数据库# coding:utf8import sysimport oscurPath = os.path.abspath(os.path.dirname(__file__))rootPath = os.path.split(curPath)[ 阅读全文

posted @ 2018-03-26 14:19 Overtimer-加班哥 阅读(131) 评论(0) 推荐(0)

读取配置文件
摘要:# -*- coding:utf-8 -*-import osimport configparserimport codecsimport jsonproDir = os.path.split(os.path.realpath(__file__))[0]configPath = os.path.jo 阅读全文

posted @ 2018-03-26 14:17 Overtimer-加班哥 阅读(206) 评论(0) 推荐(0)

类似模块的差异
摘要:1、os模块与sys模块的区别 os模块负责程序与操作系统的交互,提供了访问操作系统底层的接口 sys模块负责程序与python解释器的交互,提供了一系列的函数和变量,用于操控python的运行时环境 2、os.path.realpath(__file__)与os.getcwd()的区别 os.pa 阅读全文

posted @ 2018-03-26 14:13 Overtimer-加班哥 阅读(103) 评论(0) 推荐(0)

logging模块学习
摘要:1、创建句柄 2、句柄添加格式化输出 3、句柄添加报警级别 4、logger添加句柄 阅读全文

posted @ 2018-03-26 14:03 Overtimer-加班哥 阅读(161) 评论(0) 推荐(0)

导航