Get name of file from directory into variable

loial jldunn2000 at gmail.com
Tue Aug 3 06:21:07 EDT 2010


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 mailing list