From f539217b5bd2362f76071eab55a8c82b5d7cc2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 13 Dec 2018 21:26:30 +0400 Subject: [PATCH] :truck: Script to auto-resort tutorial src files --- scripts/rename_tutorial_src_files.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/rename_tutorial_src_files.py diff --git a/scripts/rename_tutorial_src_files.py b/scripts/rename_tutorial_src_files.py new file mode 100644 index 000000000..02878adf9 --- /dev/null +++ b/scripts/rename_tutorial_src_files.py @@ -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)