diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-15 11:04:30 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-15 11:04:30 +0800 |
commit | cfb98a4a366374a15b706cb9ed40c7026551334c (patch) | |
tree | 02fabe699deae7f56f73f5209fe6d75588887c1c /reduce.py | |
parent | 173d474cec4eccaea016c7d44f71bf250de6323f (diff) | |
download | trainer-cfb98a4a366374a15b706cb9ed40c7026551334c.tar.gz trainer-cfb98a4a366374a15b706cb9ed40c7026551334c.tar.xz trainer-cfb98a4a366374a15b706cb9ed40c7026551334c.zip |
write main for reduce.py
Diffstat (limited to 'reduce.py')
-rwxr-xr-x[-rw-r--r--] | reduce.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/reduce.py b/reduce.py index 1aa0f39..96ed368 100644..100755 --- a/reduce.py +++ b/reduce.py @@ -2,6 +2,7 @@ import os import os.path import sys +from argparse import ArgumentParser from myconfig import MyConfig @@ -45,6 +46,12 @@ def iterateSubDirectory(oldroot, newroot, level): iterateSubDirectory(olddir, newdir, level - 1) -#test case if __name__ == '__main__': - pass + parser = ArgumentParser(description='Reduce the categories.') + parser.add_argument('--level', action='store', nargs=1, default=2) + parser.add_argument('origdir', action='store') + parser.add_argument('destdir', action='store') + + args = parser.parse_args() + iterateSubDirectory(args.origdir, args.destdir, int(args.level[0])) + print('done') |