Parse HTML file : HTML Parser : Network PYTHON examples


PYTHON examples » Network » HTML Parser »

 

Parse HTML file


 

import re
filename = "index.html"

newContent = "Hello Python World"

filehandle = open(filename, "r")

data = filehandle.read()     
filehandle.close()

matching = re.subn("test", newContent, data)

if matching[1== 0:
    raise "Error while parsing HTML template"
print "Content-Type: text/htmlnn"
print matching[0]

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Network
» HTML Parser