Can anyone tell me what I've done wrong in this script. I'm trying to get only the lines that start with "This" for a text file.
Here's what I wrote: >>> import re >>> f = open('c:/lines.txt').readlines() >>> for line in f: match = re.search('^This',f) if line == match: print match here's the error message I got: Traceback (most recent call last): File "<pyshell#34>", line 2, in -toplevel- match = re.search('^This',f) File "C:\Python24\lib\sre.py", line 134, in search return _compile(pattern, flags).search(string) TypeError: expected string or buffer Thanks in advance __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor