MECH3410-P1-Graphs/gen_latex.py

12 lines
472 B
Python
Raw Normal View History

2024-08-26 10:07:48 +00:00
import os
2024-08-26 10:29:37 +00:00
root = "images\\cp"
2024-08-26 10:07:48 +00:00
for path, subdirs, files in os.walk(root):
for name in files:
if "1000rpm" not in name: continue
filePath = os.path.join(path, name)
str = "\\begin{subfigure}{0.45\\linewidth}\n \\centering\n \\includegraphics[width=0.95\\linewidth]{" + filePath.replace("\\", '/') + "}\n \\caption{" + name.replace("Percent", "\\%").replace(".png", "").replace("m_s", "m/s") + "}\n\\end{subfigure}"
print(str)