Skip to content

Instantly share code, notes, and snippets.

@nbswords
Created June 26, 2021 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbswords/c1b10a91064b8c90f9a4390e0c568e24 to your computer and use it in GitHub Desktop.
Save nbswords/c1b10a91064b8c90f9a4390e0c568e24 to your computer and use it in GitHub Desktop.
import os
image_files = []
os.chdir(os.path.join("data", "test"))
for filename in os.listdir(os.getcwd()):
if filename.endswith(".jpg"):
image_files.append("data/test/" + filename)
os.chdir("..")
with open("test.txt", "w") as outfile:
for image in image_files:
outfile.write(image)
outfile.write("\n")
outfile.close()
os.chdir("..")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment