Skip to content

Instantly share code, notes, and snippets.

@AbhiAgarwal
Created June 26, 2014 05:57
Show Gist options
  • Save AbhiAgarwal/ec3ae671921e31978a34 to your computer and use it in GitHub Desktop.
Save AbhiAgarwal/ec3ae671921e31978a34 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import os.path
if __name__ == "__main__":
if len(sys.argv) != 2:
print "usage: create_csv <base_path>"
sys.exit(1)
BASE_PATH = sys.argv[1]
SEPARATOR = ";"
label = 0
for dirname, dirnames, filenames in os.walk(BASE_PATH):
for subdirname in dirnames:
subject_path = os.path.join(dirname, subdirname)
for filename in os.listdir(subject_path):
abs_path = "%s/%s" % (subject_path, filename)
print "%s%s%d" % (abs_path, SEPARATOR, label)
label = label + 1
@yuse202
Copy link

yuse202 commented Jun 8, 2018

how to use this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment