Too Many Values To Unpack

Shashank Singh shashank.sunny.singh at gmail.com
Fri Nov 20 11:14:44 EST 2009


On Fri, Nov 20, 2009 at 9:15 PM, Victor Subervi <victorsubervi at gmail.com>wrote:

> Hi;
> At one point Dennis Lee Bieber helped me with the following slightly
> modified code:
>
> #!/usr/bin/python
>
> import sys,os
> sys.path.append(os.getcwd())
> import MySQLdb
> from login import login
> import re, string
>
> def printTree(aTree, level=0):
>   tree = []
>   for name in sorted(aTree.keys()):
>     tree.append("%s%s") % ("\t" * level, name)
>     printTree(aTree[name], level + 1)
>
> def expand(fetched):
>   aDict = {}
>   for (name, ) in fetched:
>     aDict[name] = {}
>   return aDict
>

def getChildren(levelDict, level = 0):
>   MAXLEVEL = 7
>   if level > MAXLEVEL:
>     return  #possibly the data has a cycle/loop
>   for (nm, dt) in levelDict:
>

Are you sure your key values are 2-tuples in levelDict?
For-each on dicts enumerates the keys AFAIK

-- 
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.singh at gmail.com
http://www.cse.iitb.ac.in/~shashanksingh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091120/bd447ac1/attachment-0001.html>


More information about the Python-list mailing list