How to extract the file names???

EdwardT edwardt at trillium.com
Thu Apr 19 18:47:49 EDT 2001


-----Original Message-----

From: Jake Baker [mailto:jbaker at ummelec.com]

Sent: Thursday, April 19, 2001 3:33 PM

To: e_tsang at trillium.com

Subject: RE: why radiobutton does not deselect itself??





Use the os.path.basename function.

(The os.path module has a lot of useful functions like this!)

import os.path

inputName = askopenfilename(filetypes=["{Test Log Files} {*}"])

inputName = os.path.basename(inputName)



Yours,

- Jake

>>> "Tsang, Edward1" <e_tsang at trillium.com> 04/19/01 05:27PM >>>

thanks for you reply. and just wonder if you also know the following ...

Hi currently I have the following code that asks the user for input file

names, but it returns the filesname with the full path attaching to it. ButI

just want the filenames without the fullpath how can i do it??

I amusing TkInter.

inputName = askopenfilename(filetypes=["{Test Log Files} {*}"])

e.g it will gives me:

/vobs/qa/stf/ctf/src/sample/tpu/log/tpTcCTFTEST7/tp_acc.1

But I just want tp_acc.1 . what should I do??

The file name and the ful path are not known until run time.

Ps as you notice askopenfilename also display the filename with the full

path which is very long.. ho can cut it back also?

Thanks



-----Original Message-----

From: Jake Baker [mailto:jbaker at ummelec.com]

Sent: Thursday, April 19, 2001 1:45 PM

To: edwardt at trillium.com

Subject: Re: why radiobutton does not deselect itself??



Edward,

Sounds like you want a Checkbutton instead.

Some rules for widget use:

Use a checkbutton when a value can be either on or off independant of other

settings.

Use a group of Radiobuttons when only one of a group of selections can be

selected at one time. Note that it makes no sense to use a single

Radiobutton; Radiobuttons select one from a multiple of options, one of

which has to be selected. Hence, only having one Radiobutton would mean that

lone Radiobutton is always selected.

Hope this help!

- Jake

"EdwardT" <edwardt at trillium.com> wrote in message
news:9bnom3$g9a at news.or.intel.com...
> Hi currently I have the following code that asks the user for input file
> names, but it returns the filesname with the full path attaching to it.
ButI
> just want the filenames without the fullpath how can i do it??
>
> inputName = askopenfilename(filetypes=["{Test Log Files} {*}"])
>
> e.g it will gives me:
> /vobs/qa/stf/ctf/src/sample/tpu/log/tpTcCTFTEST7/tp_acc.1
>
> But I just want tp_acc.1  . what should I do??
> The file name and the ful path are not known until run time.
> Ps as you notice askopenfilename also display the filename with the full
> path which is very long.. ho can  cut it back also?
>
> Thanks
>
>
>





More information about the Python-list mailing list