15 lines
497 B
Python
15 lines
497 B
Python
from pathlib import Path
|
|
|
|
|
|
def supprimer_commentaires_ligne(fichier):
|
|
path = Path(fichier)
|
|
lignes = path.read_text(encoding="utf-8").splitlines()
|
|
lignes_sans_commentaires = [line for line in lignes if not line.lstrip().startswith("#")]
|
|
path.write_text("\n".join(lignes_sans_commentaires), encoding="utf-8")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
base_dir = Path(__file__).resolve().parent.parent
|
|
fichier_api = base_dir / "data/data.py"
|
|
|
|
supprimer_commentaires_ligne(fichier_api)
|