new to python, currently reading diveintopython and trying to run the following code from the book:
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)
Now when i hit enter, Python shell says the if statement has a syntax error?? I'm running Python 2.7.
