[Tutor] Callable? Whats callable?

Sheila King sheila@thinkspot.net
Sun, 26 Aug 2001 10:03:56 -0700


On Sun, 26 Aug 2001 09:54:07 -0700, Sheila King <sheila@thinkspot.net>
wrote about Re: [Tutor] Callable? Whats callable?:

:Traceback (most recent call last):
:  File "C:\My Documents\temp.py", line 12, in ?
:    out_file.write(text)
:TypeError: argument must be string or read-only character buffer, not
:SRE_Pattern
:
:The point is, y.write(text) isn't going to work, because y isn't a file,
:and .write() is a file method.
:
:Now, if you try
:
:out_file.write(text)
:at least out_file is a file. So this is a bit better. HOWEVER, text
:isn't a string. And when you try to write stuff to a file, it has to be
:a string.
:
:I looked up the findall() command (since I'm not familiar with it) and
:it says that findall() returns a list of all non-overlapping matches of
:pattern in string. Well, there's a problem. text is a list, not a
:string.

Oops. I should have checked the compile() function from the re module.

In any case, text is an SRE object resulting from using compile().

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/