On Fri, Nov 20, 2009 at 9:15 PM, Victor Subervi <victorsube...@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.si...@gmail.com http://www.cse.iitb.ac.in/~shashanksingh
-- http://mail.python.org/mailman/listinfo/python-list