Hi,
Can some help me with the regular expression. I'm looking to search #
character in my file?
My file has contents:
###############################
Hello World
###############################
length = 10
breadth = 20
height = 30
###############################
###############################
Hello World
###############################
length = 20
breadth = 30
height = 40
###############################
I used the following search :
import re
fd = open(file, 'r')
line = fd.readline
pat1 = re.compile("\#*")
while(line):
mat1 = pat1.search(line)
if mat1:
print line
line = fd.readline()
But the above prints the whole file instead of the hash lines only.
Please help
Regards,
Rajat
--
http://mail.python.org/mailman/listinfo/python-list