[Tutor] Callable? Whats callable?
epoch7
epoch7@charter.net
Sun, 26 Aug 2001 11:24:16 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_001D_01C12E21.A4064F80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm new to programming, python, and even this list! So hopefullt someone =
could give me a hand with my first program.
import re
file1 =3D raw_input("Name of file to convert: ")
file2 =3D raw_input("Name of file to output to: ")
in_file =3D open(file1, "r")
out_file =3D open(file2, "w")
x =3D in_file.read()
y =3D """%s""" (x)
text =3D re.compile('url=3D(\w*)&', re.IGNORECASE)
text.findall(y)
in_file.close()
out_file.close()
thats it. it's the latest incantation of this program, ive been trying =
really hard to get this workin'.
here's the error i get:=20
Traceback (most recent call last):
File "F:\Python21\reusage.py", line 10, in ?
y =3D """%s""" (x)
TypeError: object of type 'string' is not callable
And for those of you just wondering what im trying to do, its supposed =
to search out for strings of text
between to strings("url=3D" and "&"). and then output the list of =
strings to a file.
Seems simple enough but I guess i really bit off more than i could chew =
for my first real program! :(
will
------=_NextPart_000_001D_01C12E21.A4064F80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm new to programming, python, and =
even this list!=20
So hopefullt someone could give me a hand with my first =
program.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import re<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>file1 =3D raw_input("Name of file to =
convert:=20
")<BR>file2 =3D raw_input("Name of file to output to: ")<BR>in_file =3D =
open(file1,=20
"r")<BR>out_file =3D open(file2, "w")<BR>x =3D =
in_file.read()<BR>y =3D=20
"""%s""" (x)<BR>text =3D re.compile('url=3D(\w*)&',=20
re.IGNORECASE)<BR>text.findall(y)<BR>in_file.close()<BR>out_file.close()<=
/FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>thats it. it's the latest incantation =
of this=20
program, ive been trying really hard to get this workin'.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>here's the error i get: </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Traceback (most recent call =
last):<BR> File=20
"F:\Python21\reusage.py", line 10, in ?<BR> y =3D =
"""%s"""=20
(x)<BR>TypeError: object of type 'string' is not callable</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>And for those of you just wondering =
what im=20
trying to do, its supposed to search out for strings of =
text</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>between to strings("url=3D" and =
"&"). and=20
then output the list of strings to a file.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Seems simple enough but I guess i =
really bit off=20
more than i could chew for my first real program! :(</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>will</FONT></DIV></BODY></HTML>
------=_NextPart_000_001D_01C12E21.A4064F80--