python读取html文件中的内容并输出_python读取html中指定元素生成excle文件示例

#coding=gbk

import string

import codecs

import os,time

import xlwt

import xlrd

from bs4 import BeautifulSoup

from xlrd import open_workbook

class LogMsg:

def __init__(self,logfile,Level=0):

try:

import logging

#self.logger = None

self.logger = logging.getLogger()

self.hdlr = logging.FileHandler(logfile)

formatter = logging.Formatter("[%(asctime)s]: %(message)s","%Y%m%d %H:%M:%S")

self.hdlr.setFormatter(formatter)

self.logger.addHandler(self.hdlr)

#logger.setLevel()

if Level == 10:

self.logger.setLevel(logging.DEBUG)

elif Level == 20:

self.logger.setLevel(logging.INFO)

elif Level == 30:

self.logger.setLevel(logging.WARNING)

elif Level == 40:

self.logge

你可能感兴趣的:(python读取html文件中的内容并输出_python读取html中指定元素生成excle文件示例)