[Tutor] diving into py question
Chelan Farsight
chelan.farsight at gmail.com
Thu May 19 23:18:38 CEST 2005
I am using the online book Dive Into Python.
I ran the first program given and have run into an error on line 7 at
the colon. Now I imagine that there is probably a corrections page at
the site, but I am interested in knowing why it won't work as much as
what I need to do to correct it. Any help would be appreciated. The
script follows:
def buildConnectionString(params):
"""Build a connection string from a dictionary of parameters.
Returns string."""
return ";".join(["%s=%s" % (k, v) for k, v in params.items()])
if_name_ == "_main_":
myParams = {"server":"mpilgrim", \
"database":"master", \
"uid":"sa", \
"pwd":"secret" \
}
print buildConnectionString(myParams)
More information about the Tutor
mailing list