Last active
November 12, 2019 09:44
-
-
Save yjzhang/09c878afbb9446e7cd99134a0237bc9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
filenames = os.listdir('.') | |
for filename in filenames: | |
name = filename.split('_')[0] | |
if not os.path.exists(name): | |
os.makedirs(name) | |
os.rename(filename, os.path.join(name, filename)) | |
if filename.endswith('zip'): | |
subprocess.call(['unzip', os.path.join(name, filename), '-d', name]) | |
for base, dirs, files in os.walk('.'): | |
for filename in files: | |
if filename.endswith('ipynb'): | |
subprocess.call(['jupyter', 'nbconvert', os.path.join(base, filename), '--to', 'pdf']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment