[Tutor] ok, got a primitive but workable solution
Sean 'Shaleh' Perry
Fri, 28 Dec 2001 14:58:26 -0800 (PST)
On 28-Dec-2001 Kirk Bailey wrote:
> I wanted to trim a statement down to give me ONLY the name of the list.
> I got it.
> Probably not the best solution, but it works, and works in python 1.5.2
> which is what is in my server.
> 'list' is a string, such as: './lists/testlist3.info'
> I want to extract the pure list name so I can display ONLY that. This
> def getname(list):
> return c
apparently you missed my mail.
def getname(thing): # list is A BAD NAME TO USE
name = os.path.basename(thing)
name, ext = os.path.splitext(name)