Reputation: 29
In the following code sample, the last line (print buildConnectionString(myParams)
) is throwing the following error:
Invalid syntax
def buildConnectionString(params):
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)
Upvotes: 1
Views: 49
Reputation: 14849
Assuming that you're on Python 3, print is a function and needs to be wrapped in parentheses:
print(buildConnectionString(myParams))
Upvotes: 7