[Tutor] ok, got a primitive but workable solution

alan.gauld@bt.com alan.gauld@bt.com
Mon, 31 Dec 2001 13:52:28 -0000


Kirk,

Just one wee suggestion:

> I want to extract the pure list name so I can display 
> ONLY that. This works.
> 
> def getname(list):
> 	a=string.split(list,'/')
> 	b=a[2]

instead of using 2 how about -1 to always get the 
last element.

If the configuration ever results in more than one level 
of depth your version will break. Always getting the 
last element shoud make it more resistant to change.

Just a thought...

> 	c=string.split(b,'.')
> 	return c[0]

Alan G.