Get name of file from directory into variable
landimatte at gmail.com
Tue Aug 3 12:34:43 CEST 2010
I suggest you to take a look at walk function inside the os module
; IIRC, on the list you would find a discussion on how to create a
wrapper for os.walk with support for filters or wildcards.
On Tue, Aug 3, 2010 at 12:21 PM, loial <jldunn2000 at gmail.com> wrote:
> In a unix shell script I can do something like this to look in a
> directory and get the name of a file or files into a variable :
> MYFILE=`ls /home/mydir/JOHN*.xml`
> Can I do this in one line in python?
More information about the Python-list