I haven't understood what you are trying to do. Make HTML editor? Read HTML? or what? Can you please elaborate more?
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
An html file has no "output", it's just an html file. There are programs to convert an html file to a text file or a pdf file, you should google for that.
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
So you wan't to strip out non HTML tags and leave only HTML?
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
import BeautifulSoup as bs
html = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Test JSON </TITLE>
<script language="JavaScript">
function checkJSON()
{
try
{
var v = eval(TextJSON.value);
var OK='OK'
document.write("OK");
}
catch (ex)
{
document.write("Error:"+ex);
}
TextJSON.focus();
}
</script>
</HEAD>
<BODY >
<table width="100%" border="0">
<tr>
<td>
<textarea rows="15" cols="70" id="TextJSON" Style = "visibility:hidden">Hello</textarea>
</td>
</tr>
</table><script language="JavaScript">
checkJSON();
</script>
</BODY>
</HTML>
"""
soup = bs.BeautifulSoup(html)
divs = soup.findAll('textarea')
children = divs[0].contents
print divs[0].string # Hello
This find Hello in test12js.txt
Html dos not ever output anything as Gribouillis pointed out.
You parse html an find text like i did here.
You are better off learing more basic stuff about python and html.
snippsat
Practically a Posting Shark
808 posts since Aug 2008
Reputation Points: 353
Solved Threads: 294
It's not at all clear, what do you mean when you say that you invoke an html file ?
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691