Getting list of filenames in a folder

I’m trying to write the Python equivalent of Java’s:

fileList = dataFile("").listFiles();

I’m not seeing a listFiles() in the Python reference. Am I missing it, or a work-around?

1 Like

Use global variable this in order to access any PApplet member:
That is, replace dataFile('') w/ this.dataFile('')


Alternatively, if a PApplet member happens to be static, variable this can be replaced w/ PApplet: :nerd_face:

  1. rnd = round(random(width)) -> Python’s builtin version.
  2. rnd = this.round(random(width)) -> PApplet version.
  3. rnd = PApplet.round(random(width)) -> PApplet version too.
1 Like