Peter Otten wrote:
> or use next():
>
> filenames = next(walk("."))[2]
> print(filenames)
Be warned though that if you try this with a non-existent or otherwise
inaccessible directory you will get an exception:
$ sudo mkdir forbidden
$ sudo chmod a-r forbidden
$ python3 -c 'import os; next(os
Gary Roach wrote:
> Hi
>
> Debian stretch OS
> KDE Desktop
> Code written with Kate
> Run in command line with $python getFileNames.py
>
> Code:
>
> from os import walk
> import subprocess
>
> f = []
> x = ""
> for (dirpath, dirnames, filenames) in walk('.'):
> print(filenames)
>
> This