At 02:41 AM 1/5/2006, Intercodes wrote:
Hello everyone,

    Iam new to this mailing list as well as python(uptime-3 weeks).Today I learnt about RE from http://www.amk.ca/python/howto/regex/.This one was really helpful. I started working out with few examples on my own. The first one was to collect all the HTML tags used in an HTML file. I wrote this code.

------------------------------
import re
file1=open(raw_input("\nEnter The path of the HTML file: "),"r")
ans=""
while 1:
    data="">     if data="">         break
    ans=ans+data   

Consider a shorter way to grab the entire file:
ans = open(raw_input("\nEnter The path of the HTML file: "),"r").read()

[snip]
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to