SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    437
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    the python code.

    Code:
    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)
    i have typed the above code into gedit, when execute it, it showed an error, said: the line 4 have an illegal indent. but i fell there was't an illegal indent,why?
    Outdoor tools online store and wargame tools shop
    with best quality and service.
    comp molle tactical vest tactical clothing etc sell

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    I don't see ANY indenting of your code. However maybe it's been lost in your posting?

    Python cares about indenting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •