pythonpathdirectoryfilesystemsdirectory-listing

How can I list the contents of a directory in Python?


Can’t be hard, but I’m having a mental block.


Solution

  • import os
    os.listdir("path") # returns list