17 lines
523 B
Python
17 lines
523 B
Python
import os
|
|
|
|
racine = "." # point de départ = dossier courant
|
|
|
|
def detect_fichiers_non_utf8(dossier):
|
|
for root, dirs, files in os.walk(dossier):
|
|
for file in files:
|
|
if file.endswith(".py"):
|
|
chemin = os.path.join(root, file)
|
|
try:
|
|
with open(chemin, encoding="utf-8") as f:
|
|
f.read()
|
|
except UnicodeDecodeError:
|
|
print(f"⚠️ Encodage non UTF-8 : {chemin}")
|
|
|
|
detect_fichiers_non_utf8(racine)
|