This script will make a folder structure that will match the needs of EXL skills. You will be prompted to enter the unit number along with the unit name. Once you have entered these values, you will want to enter a list of lectures that should be seperated by spaces.
This is super useful to prototype your lectures and get the format started out. Let me know if there is functionality that you would like me to add as I can easily do that.
Current features I am working on:
- Making the script add a final exam at the end so that it doesn't require another script
- Making the script so that it doesnt require you specify Unit Number
To use
- Copy the following code into a script that is called
create_unit.py
- From command line run
$ python create_unit.py
You may need to install the libraries os and pathlib
For example to create a unit on Basic Python (unit 1) with lectures on variables and logic you would type the following commands
$ python create_unit.py
>> What Unit Number would you like to create? 1
>> What is the name of the topic you would like to create? Basic_Python
>> Please enter the names of the lectures, each separated by a space: Variables Logic
- Below is the code to paste into the
create_unit.py
file:
import os
from pathlib import Path
# Get the unit number and name from the user
unit_number = input('What Unit Number would you like to create? ')
print('\n','--'*50,'\n')
topic_name = input('What is the name of the topic you would like to create? ')
print('\n','--'*50,'\n')
# Formatting Procedures
if int(unit_number) < 10:
unit_number = ''.join(['0',unit_number,'_'])
else:
unit_number = ''.join([unit_number,'_'])
# Create the topic name and make the directory
topic_name = ''.join([unit_number,topic_name])
os.mkdir(topic_name)
# Get the lecture names from the user
lecture_names = input('Please enter the names of the lectures, each serperated by a space: ')
#Go through the lecture names and create a folder with an index.md file in each
for i,name in enumerate(lecture_names.split(' ')):
# Format the lecture folders
if i <10:
lecture_name = (''.join([str(0)+str(i)+'_',name[:]]))
else:
lecture_name = (''.join([str(i)+'_',name[:]]))
# Create the filepath
file_path = ''.join([topic_name+'/'+lecture_name])
# Make the new directory
os.mkdir(file_path)
# Make the index.md file
f2 = ''.join([file_path,'/index.md'])
Path(f2).touch()
print('\n','--'*50,'\n')
print('Lectures created, check your working directory')
@svarlamov