Skip to content

Instantly share code, notes, and snippets.

@lqqyt2423
Created February 25, 2019 06:19
Show Gist options
  • Save lqqyt2423/f6779249c05dd721748eab7c031f81bb to your computer and use it in GitHub Desktop.
Save lqqyt2423/f6779249c05dd721748eab7c031f81bb to your computer and use it in GitHub Desktop.
合并当前目录下的文件,全部打印出来
#! /usr/bin/env python3
import os
root_dir = os.getcwd()
names = ["js"]
def list_code(dir):
for lists in os.listdir(dir):
path = os.path.join(dir, lists)
if 'node_modules/' in path or 'mock/' in path:
continue
if os.path.isfile(path) and os.path.splitext(path)[-1][1:] in names:
with open(path) as f:
print(f.read())
if os.path.isdir(path):
list_code(path)
list_code(root_dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment