text-mode tree viewer?

Martin Skou msj at infoserv.dk
Tue Jun 26 08:06:34 EDT 2007


Not quite, but almost:


data=[["Peter",
            ["Ian",
           [["Randy",
                      ["Clara"]]]]],
   "Paul",
  ["Mary",
            ["Arthur"]]]


def show(data,level):
	for i in data:
		if i.__class__.__name__=='list':
			show(i,level+1)
		else:
			print '%s->%s' % ('-'*level,i)
		
		
show(data,0)


/Martin



More information about the Python-list mailing list