---
title: "SGMLparser闭合标签start和end处理逻辑"
author: "conjohn668"
date: "2010-09-19T00:26:09Z"
tags: []
categories: ["编程语言"]
slug: "sgmlparser-start-end"
draft: false
lastmod: "2010-09-19T00:26:09Z"
id: 766847
url: "https://conjohn668.iteye.com/blog/766847"
---

忙活了半天，原来是个小问题

 

def start\_\*\*\*(self,attrs):

#这个地方处理逻辑

self.\*\*\*\_tag  = True

 

def end\_\*\*\*(self):

#这个地方处理逻辑

self.\*\*\*\_tag = False

 

 

其中\*\*\*是成对的闭合标签，这个逻辑才有意义

 

单标签使用单一的do\_\*\*\*(self)方法

 

爽！！！！