12345678910111213141516171819202122 |
- # -*- coding: utf-8 -*-
- #!/usr/bin/env python
- # 打印出所有某目录的文件后缀
- from base import *
- from apilib.utils import flatten
- STATIC_DIR = os.path.join(PROJECT_ROOT, 'static')
- @click.command()
- def check():
- file_with_ext = lambda filename: len(filename.split('.')) > 1
- print '|'.join(set([ e.split('.')[-1] for e in
- flatten(
- [ files for root, dirs, files in os.walk(STATIC_DIR)]) if file_with_ext(e) ]))
- click.echo('success!')
- if __name__ == "__main__":
- check()
|