Get name of file from directory into variable
Matteo Landi
landimatte at gmail.com
Tue Aug 3 06:34:43 EDT 2010
I suggest you to take a look at walk function inside the os module
[1]; IIRC, on the list you would find a discussion on how to create a
wrapper for os.walk with support for filters or wildcards.
Regards.
[1] http://docs.python.org/library/os.html?highlight=os.walk#os.walk
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?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Matteo Landi
http://www.matteolandi.net/
More information about the Python-list
mailing list