I have
path='/path/2/foo' ls $path
yields a list of files in the path. What do I do if I want to convert that to a list of strings of filenames?
Thanks
I have
path='/path/2/foo' ls $path
yields a list of files in the path. What do I do if I want to convert that to a list of strings of filenames?
Thanks
Use os.listdir
:
import os
path = '/path/2/foo'
filenames = os.listdir(path)