[Tutor] Callable? Whats callable?

Sheila King sheila@thinkspot.net
Sun, 26 Aug 2001 08:44:52 -0700


On Sun, 26 Aug 2001 11:40:34 -0400, "epoch7" <epoch7@charter.net>  wrote
about Re: [Tutor] Callable? Whats callable?:

:> try changing this line:
:>  y = """%s""" (x)
:>
:> to this:
:> y = """%s""" % x
:>
:>
:> At least the program runs now. I don't know if it does what you want,
:> but it won't give that error any more...
:
:True enough, now i try to call it(CALLable, i was thinking of it like
:CALable, must have shorted out a braincell)
:and i get no list, and i tried to print y and it locked up python.

Well, I ran this code:

import re

file1 = raw_input("Name of file to convert: ")
file2 = raw_input("Name of file to output to: ")
in_file = open(file1, "r")
out_file = open(file2, "w")
x = in_file.read()
y = """%s""" % x
text = re.compile('url=(\w*)&', re.IGNORECASE)
text.findall(y)
in_file.close()
out_file.close()

and I got no reported errors.

I'm no good at the regular expressions stuff, so I can't help you there.
But you might try adding some print statements into the code, so you can
see what is going on in the program.

You know, like after
x = in_file.read()

do a 
print x

and after
y = '''%s''' % x

do a
print y

and so on. This might help you to track down where any errors are
occurring.

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