newbie wants to compile python list of filenames in selected directories
Greg Krohn
greg at invalid.invalid
Sun Feb 6 13:41:27 EST 2005
anthonyberet wrote:
> Hi, I am new at Python, and very rusty at the one language I was good
> at, which was BASIC.
>
> I want to write a script to compare filenames in chosen directories, on
> windows machines. Ideally it would compose a list of strings of all the
> filenames in the directories, and those directories would be chosable by
> the user of the script.
>
> I am quite happy to do my own legwork on this , I realise it is simple
> stuff, but can anyone point me in the right direction to start?
>
> Thanks
os.listdir does almost exactly what you are asking for. For a little
more flexibility, you can use os.path.walk, although it's not quite as
newb friendly.
-greg
More information about the Python-list
mailing list