---
title: "html 2 txt (完善中)"
author: "fudehai001"
date: "2009-07-23T17:01:22Z"
tags: []
slug: "html-2-txt"
draft: false
lastmod: "2009-07-23T17:01:22Z"
id: 431699
url: "https://laozy.iteye.com/blog/431699"
---

import re 

filename=raw_input('input a filename,please  ') 
s=file(filename).read() 
ss=s.replace('\n','') 
ss=ss.replace('&nbsp;','') 
ss=ss.replace('&#187;','') 
ss=re.sub("<!--.+?-->",' ',ss) 
tem=re.sub("<.*?>",'',ss) 
w=open('zip.txt','w') 
w.write(tem) 
w.close()