Sage100-ws/cleaner.py

17 lines
467 B
Python

from pathlib import Path
def supprimer_commentaires_ligne(fichier: str) -> None:
path = Path(fichier)
lignes_filtrees = []
with path.open("r", encoding="utf-8") as f:
for ligne in f:
if ligne.lstrip().startswith("#"):
continue
lignes_filtrees.append(ligne)
path.write_text("".join(lignes_filtrees), encoding="utf-8")
if __name__ == "__main__":
supprimer_commentaires_ligne("sage_connector.py")