Skip to content

Commit

Permalink
🚚 Script to auto-resort tutorial src files
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Dec 13, 2018
1 parent a47243d commit f539217
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/rename_tutorial_src_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#%%
from pathlib import Path
from string import digits


#%%
directory = Path("../docs/tutorial/src")
output_directory = Path("../docs/tutorial/out")
files = sorted([Path(f) for f in directory.iterdir()])
for i, f in enumerate(files):
f: Path
index = str(i + 1).zfill(2)
new_name = output_directory / f"tutorial{index}.py"
print(new_name)
f.rename(new_name)

0 comments on commit f539217

Please sign in to comment.