{"id":222,"date":"2024-12-04T15:41:17","date_gmt":"2024-12-04T14:41:17","guid":{"rendered":"https:\/\/network360.fr\/?p=222"},"modified":"2025-06-27T18:18:34","modified_gmt":"2025-06-27T16:18:34","slug":"python-config-cleaner","status":"publish","type":"post","link":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/","title":{"rendered":"Python \u2013 Config\u00a0Cleaner"},"content":{"rendered":"\n<p>R\u00e9cemment j\u2019ai effectu\u00e9 une migration chez un client dans le B\u00e9arn.<\/p>\n\n\n\n<p>Le but de cette migration \u00e9tait de changer leur c\u0153ur de r\u00e9seau.<\/p>\n\n\n\n<p>Jusqu\u2019ici, rien de bien probl\u00e9matique pour un ing\u00e9nieur r\u00e9seau confirm\u00e9.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p>Suite \u00e0 cette migration, le lendemain, le client me demande de reconfigurer un&nbsp;<strong>port-mirroring<\/strong>&nbsp;qui ne fonctionnait plus.<\/p>\n\n\n\n<p class=\"has-text-align-center\">                                                                  Aucun probl\u00e8me !<\/p>\n\n\n\n<p>Sauf que son&nbsp;<strong>port-mirroring&nbsp;<\/strong>\u00e9tait constitu\u00e9&nbsp;<strong>de plus de 800 interfaces vlans.<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\">                                                                                Ah !<\/p>\n\n\n\n<p>Je me dis que je vais faire un copier-coller d\u2019un&nbsp;<strong>show vlan&nbsp;<\/strong>et je vais pouvoir traiter les donn\u00e9es avec&nbsp;<strong>notepad++.<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\">                                                                        Que nenni !<\/p>\n\n\n\n<p>Les donn\u00e9es sorties du&nbsp;<strong>show vlan&nbsp;<\/strong>\u00e9taient mal indenter, avec des espaces dans tous les sens.<\/p>\n\n\n\n<p>C\u2019est l\u00e0 que je me suis dit\u2026 Tiens, et si j\u2019utilisais du&nbsp;<strong>Python.<\/strong><\/p>\n\n\n\n<p>Voila comment j\u2019ai proc\u00e9d\u00e9<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img decoding=\"async\" data-src=\"https:\/\/networktrainingnotes.wordpress.com\/wp-content\/uploads\/2024\/11\/raton_perdu.webp?w=1024\" alt=\"\" class=\"wp-image-5289 lazyload\" style=\"width:392px;height:auto\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Dans un premier temps j\u2019ai r\u00e9cup\u00e9rer la liste des&nbsp;<em><strong>vlans&nbsp;<\/strong><\/em>pour effectuer mon&nbsp;<strong><em>template&nbsp;<\/em><\/strong>de configuration.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">vlan 10\n   vlan 20\nvlan 30\n  vlan 45\nvlan 50\nvlan 60\nvlan 700\n    vlan 800<\/pre>\n\n\n\n<p><em>PS : J&rsquo;ai raccourci pour que ce soit lisible. <\/em><\/p>\n\n\n\n<p>Le but \u00e9tant d\u2019avoir cette configuration \u00e0 la fin<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">source vlan 10 both\nsource vlan 20 both\nsource vlan 30 both\nsource vlan 45 both\nsource vlan 50 both\nsource vlan 60 both\nsource vlan 700 both\nsource vlan 800 both<\/pre>\n\n\n\n<p>Pour obtenir ce r\u00e9sultat, je vais effectuer 3 actions :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Nettoyer les espaces<\/li>\n\n\n\n<li>Ajouter le texte au d\u00e9but &amp; \u00e0 la fin de chaque ligne<\/li>\n\n\n\n<li>Sauvegarder le tout dans un fichier<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\"><strong>Nettoyage des espaces<\/strong><\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Un fois r\u00e9cup\u00e9r\u00e9 en CLI, je copie\/colle mes donn\u00e9es dans mon&nbsp;<strong>IDE (integrated development environment)<\/strong>,&nbsp;<strong>Visual Studio Code.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" data-src=\"https:\/\/networktrainingnotes.wordpress.com\/wp-content\/uploads\/2024\/11\/image.png?w=638\" alt=\"\" class=\"wp-image-5297 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p>Je cr\u00e9\u00e9 ensuite un fichier, que j\u2019appelle&nbsp;<strong>cleaner.py.<\/strong><\/p>\n\n\n\n<p>Il servira de&nbsp;<strong>script python&nbsp;<\/strong>pour nettoyer mes donn\u00e9es.<\/p>\n\n\n\n<p>Dans un premier temps je vais&nbsp;<strong>importer mes donn\u00e9es dans cleaner.py<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">data = \"SiteWeb\/data.txt\"\nwith open(data, \"r\") as f:\n    for i in f:\n        a = i.strip()\n        print(a)<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Dans les deux premi\u00e8res lignes,&nbsp;<\/strong>je fais d\u00e9finir le chemin des donn\u00e9es, puis importer ces donn\u00e9es dans mon fichier python.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>D\u00e9finir le chemin de mes donn\u00e9es (<strong>data = \u00ab&nbsp;Chemin Relatif&nbsp;\u00bb<\/strong>)<\/li>\n\n\n\n<li><strong>With open(data, \u00ab\u00a0r\u00a0\u00bb) as f<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Ouvrir le fichier d\u00e9finit dans le chemin data<\/li>\n\n\n\n<li>L\u2019ouvrir en tant que r,&nbsp;<strong>Read-only<\/strong><\/li>\n\n\n\n<li>Stocker le contenu de ce fichier dans&nbsp;<strong>la variable f<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>Dans les 3 derni\u00e8res lignes,<\/strong>&nbsp;je vais effectuer une action pour chaque ligne dans le fichier.<\/p>\n\n\n\n<p>On pourrait le lire ainsi. Pour chaque ligne&nbsp;<strong>(i)<\/strong>&nbsp;dans le fichier&nbsp;<strong>(f)<\/strong>, je nettoie (<strong>strip<\/strong>) la ligne des caract\u00e8res (<strong>strip()<\/strong>, soit les espaces), et je stocke cela dans&nbsp;<strong>a<\/strong>. Ensuite j\u2019affiche&nbsp;<strong>a<\/strong>.<\/p>\n\n\n\n<p>Une fois fini, je passe \u00e0 la ligne suivante.<\/p>\n\n\n\n<p>Quand toutes les lignes sont pass\u00e9 dans la moulinette, j\u2019arr\u00eate le script.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For i in f:<\/strong>&nbsp;Pour chaque ligne dans f<\/li>\n\n\n\n<li><strong>a = i.strip()<\/strong>&nbsp;: Je supprime les espaces<\/li>\n\n\n\n<li><strong>print(a)<\/strong>&nbsp;: j\u2019affiche<\/li>\n<\/ul>\n\n\n\n<p>Le r\u00e9sultat :<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">vlan 10\nvlan 20\nvlan 30\nvlan 45\nvlan 50\nvlan 60\nvlan 700\nvlan 800<\/pre>\n\n\n\n<p>Youpi ! Mon texte est nettoy\u00e9. Il faut maintenant que j\u2019ajoute un morceau au d\u00e9but et \u00e0 la fin de chaque ligne.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\"><strong>Ajout de texte<\/strong><\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Pour rappel on doit avoir cette finalit\u00e9 \u00e0 chaque ligne.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">source vlan 10 both<\/pre>\n\n\n\n<p>On note 3 parties :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Avant :&nbsp;<strong>source<\/strong><\/li>\n\n\n\n<li>Milieu :&nbsp;<strong>la valeur de la variable a&nbsp;<\/strong>(ce qui fait le&nbsp;<strong>print<\/strong>&nbsp;dans la partie pr\u00e9c\u00e9dente)<\/li>\n\n\n\n<li>Apr\u00e8s :&nbsp;<strong>both<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-center\">On va faire simple !<\/p>\n\n\n\n<p>Vu que j\u2019ai d\u00e9j\u00e0 r\u00e9ussi \u00e0 faire un&nbsp;<strong>print&nbsp;<\/strong>des vlans, il ne me suffit qu\u2019\u00e0 faire un&nbsp;<strong>print&nbsp;<\/strong>avant et un&nbsp;<strong>print&nbsp;<\/strong>apr\u00e8s.<\/p>\n\n\n\n<p>En gros, afficher \u00ab&nbsp;<strong>source&nbsp;\u00bb<\/strong>; afficher la valeur de&nbsp;<strong>\u00ab&nbsp;a&nbsp;\u00bb<\/strong>, afficher&nbsp;<strong>\u00ab&nbsp;both&nbsp;\u00bb<\/strong><\/p>\n\n\n\n<p>Rien de plus simple<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">data = \"SiteWeb\/data.txt\"\nwith open(data, \"r\") as f:\n    for i in f:\n        a = i.strip()\n        print(f\"source {a} both\")<\/pre>\n\n\n\n<p>J\u2019ai modifi\u00e9 mon code pr\u00e9c\u00e9dent. Je ne souhaite plus afficher que la valeur de \u00ab&nbsp;a&nbsp;\u00bb, je veux afficher d\u2019autre choses.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">print(f\"source {a} both\")<\/pre>\n\n\n\n<p>affiche&nbsp;<strong>source,&nbsp;<\/strong>puis la variable&nbsp;<strong>a<\/strong>, puis&nbsp;<strong>both.<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\">C\u2019est quoi le f ?<\/p>\n\n\n\n<p>En faite, dans mon&nbsp;<strong>print<\/strong>&nbsp;je mixe des donn\u00e9es sous forme de texte&nbsp;<strong>(string, str)&nbsp;<\/strong>et des donn\u00e9es sous forme de&nbsp;<strong>variable (a)<\/strong>.<\/p>\n\n\n\n<p>Si je veux faire \u00e7a, je dois utiliser des&nbsp;<strong>f-string<\/strong>&nbsp;(Qu\u2019\u00e0 partir de python 3.6)<\/p>\n\n\n\n<p>C\u2019est pour cela que je met le&nbsp;<strong>f<\/strong>, puis mon expression avec ma&nbsp;<strong>variable entre {}.<\/strong><\/p>\n\n\n\n<p>Le r\u00e9sultat<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">source vlan 10 both\nsource vlan 20 both\nsource vlan 30 both\nsource vlan 45 both\nsource vlan 50 both\nsource vlan 60 both\nsource vlan 700 both\nsource vlan 800 both<\/pre>\n\n\n\n<p class=\"has-text-align-center\"><strong>Yes !<\/strong><\/p>\n\n\n\n<p>En soi, je pourrais faire un copier\/coller sans n\u00e9cessairement faire un export dans un fichier. Dans le cas pr\u00e9senter c\u2019est faisable, mais avec 800 lignes c\u2019est moins pratique !<\/p>\n\n\n\n<p>En plus, on touche le but !<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\"><strong>Export dans un fichier<\/strong><\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Nous y sommes. Comment copier chaque ligne dans un fichier texte ?<\/p>\n\n\n\n<p>On va simplement ouvrir un fichier&nbsp;<strong>non cr\u00e9\u00e9&nbsp;<\/strong>et dire que pour chaque it\u00e9ration on \u00e9crit dans ce fichier.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">data = \"SiteWeb\/data.txt\"\ndestination = \"SiteWeb\/destination.txt\"\nwith open(data, \"r\") as f:\n    with open(destination, \"w\") as g:\n        for i in f:\n         a = i.strip()\n         result = f\"source {a} both\\n\"\n         g.write(result)<\/pre>\n\n\n\n<p>ligne 2 : Je d\u00e9finit un nouveau fichier&nbsp;<strong>destination<\/strong>, avec son chemin relatif.<\/p>\n\n\n\n<p>ligne 4 : J\u2019ouvre mon fichier&nbsp;<strong>destination<\/strong>, en tant que<strong>&nbsp;write<\/strong>&nbsp;<strong>(\u00ab&nbsp;w&nbsp;\u00bb)<\/strong>, et j\u2019utilise comme variable&nbsp;<strong>g.<\/strong><\/p>\n\n\n\n<p>La suite peut se lire ainsi :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pour chaque ligne dans le fichier source (ligne 5)<\/li>\n\n\n\n<li>Je nettoie les espaces (ligne 6)<\/li>\n\n\n\n<li>J\u2019\u00e9cris \u00ab&nbsp;source&nbsp;<em>valeurdea&nbsp;<\/em>both&nbsp;\u00bb et je fais un saut \u00e0 la ligne (\\n) (ligne7)<\/li>\n\n\n\n<li>J\u2019\u00e9cris dans le fichier destination le r\u00e9sultat de mon it\u00e9ration.<\/li>\n<\/ul>\n\n\n\n<p>Voici mon IDE&nbsp;<strong>avant&nbsp;<\/strong>d\u2019avoir lancer le code<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" data-src=\"https:\/\/networktrainingnotes.wordpress.com\/wp-content\/uploads\/2024\/11\/image-3.png?w=648\" alt=\"\" class=\"wp-image-5329 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p>Voici mon IDE&nbsp;<strong>apr\u00e8s&nbsp;<\/strong>d\u2019avoir lancer le code<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" data-src=\"https:\/\/networktrainingnotes.wordpress.com\/wp-content\/uploads\/2024\/11\/image-4.png?w=633\" alt=\"\" class=\"wp-image-5330 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\">La diff\u00e9rence ?<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>J\u2019ai un fichier&nbsp;<strong>destination.txt qui est apparu !<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img decoding=\"async\" data-src=\"https:\/\/networktrainingnotes.wordpress.com\/wp-content\/uploads\/2024\/11\/raont_content.webp?w=1024\" alt=\"\" class=\"wp-image-5334 lazyload\" style=\"width:331px;height:auto\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p>Voici mon code final :<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">data = \"SiteWeb\/data.txt\"\ndestination = \"SiteWeb\/destination.txt\"\nwith open(data, \"r\") as f:\n    with open(destination, \"w\") as g:\n        for i in f:\n         a = i.strip()\n         result = f\"source {a} both\\n\"\n         g.write(result)<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Conclusion<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Gr\u00e2ce \u00e0 un petit morceau de&nbsp;<strong>python<\/strong>,&nbsp;<strong>8 lignes seulement,&nbsp;<\/strong>on peut s\u2019affranchir de t\u00e2che r\u00e9p\u00e9titives.<\/p>\n\n\n\n<p>Dans le cas pr\u00e9senter, nous nous attardons sur la n\u00e9cessit\u00e9 de reconfigurer un \u00e9quipement r\u00e9seau. Mais la logique s\u2019applique dans d\u2019autres domaines comme pour le nettoyage de document Excel, le inventaire des commer\u00e7ants\u2026<\/p>\n\n\n\n<p>NB :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Les informations ont volontairement \u00e9t\u00e9 modifi\u00e9 pour garantir la s\u00e9curit\u00e9 de donn\u00e9es du client. L\u2019id\u00e9e de base \u00e9tant la m\u00eame, \u00e0 savoir r\u00e9cup\u00e9rer des donn\u00e9es, les nettoyer pour les r\u00e9utiliser.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Cr\u00e9ation d&rsquo;un petit script python pour nettoyer des donn\u00e9es et cr\u00e9er un script de configuration<\/p>\n","protected":false},"author":1,"featured_media":599,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"no-sidebar","site-content-layout":"","ast-site-content-layout":"normal-width-container","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[22],"tags":[27,25,26],"class_list":["post-222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automatisation","tag-debutant","tag-python","tag-script"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Nettoyage de configuration avec Python<\/title>\n<meta name=\"description\" content=\"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nettoyage de configuration avec Python\" \/>\n<meta property=\"og:description\" content=\"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/\" \/>\n<meta property=\"og:site_name\" content=\"Network360\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-04T14:41:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-27T16:18:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"524\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/\"},\"author\":{\"name\":\"Admin\",\"@id\":\"https:\\\/\\\/network360.fr\\\/#\\\/schema\\\/person\\\/0f765d2aa5031b9c6e0ff879e9622f00\"},\"headline\":\"Python \u2013 Config\u00a0Cleaner\",\"datePublished\":\"2024-12-04T14:41:17+00:00\",\"dateModified\":\"2025-06-27T16:18:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/\"},\"wordCount\":1002,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/network360.fr\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/pexels-photo-1181271-1181271.jpg\",\"keywords\":[\"Debutant\",\"Python\",\"Script\"],\"articleSection\":[\"Automatisation\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/\",\"url\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/\",\"name\":\"Nettoyage de configuration avec Python\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/network360.fr\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/pexels-photo-1181271-1181271.jpg\",\"datePublished\":\"2024-12-04T14:41:17+00:00\",\"dateModified\":\"2025-06-27T16:18:34+00:00\",\"description\":\"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#primaryimage\",\"url\":\"https:\\\/\\\/network360.fr\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/pexels-photo-1181271-1181271.jpg\",\"contentUrl\":\"https:\\\/\\\/network360.fr\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/pexels-photo-1181271-1181271.jpg\",\"width\":524,\"height\":350,\"caption\":\"Laptop displaying code with reflection, perfect for tech and programming themes.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/2024\\\/12\\\/04\\\/python-config-cleaner\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/network360.fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python \u2013 Config\u00a0Cleaner\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/network360.fr\\\/#website\",\"url\":\"https:\\\/\\\/network360.fr\\\/\",\"name\":\"Network360\",\"description\":\"Network360.FR | Boostez votre carri\u00e8re r\u00e9seau : CCNA, Cisco, Automation |\",\"publisher\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/network360.fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/network360.fr\\\/#organization\",\"name\":\"Network360\",\"url\":\"https:\\\/\\\/network360.fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/network360.fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/network360.fr\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/cropped-LOGO3-3_preview_rev_1-1.png?fit=501%2C410&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/network360.fr\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/cropped-LOGO3-3_preview_rev_1-1.png?fit=501%2C410&ssl=1\",\"width\":501,\"height\":410,\"caption\":\"Network360\"},\"image\":{\"@id\":\"https:\\\/\\\/network360.fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/network360.fr\\\/#\\\/schema\\\/person\\\/0f765d2aa5031b9c6e0ff879e9622f00\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g\",\"caption\":\"Admin\"},\"sameAs\":[\"https:\\\/\\\/network360.fr\"],\"url\":\"https:\\\/\\\/network360.fr\\\/index.php\\\/author\\\/netadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nettoyage de configuration avec Python","description":"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/","og_locale":"fr_FR","og_type":"article","og_title":"Nettoyage de configuration avec Python","og_description":"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.","og_url":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/","og_site_name":"Network360","article_published_time":"2024-12-04T14:41:17+00:00","article_modified_time":"2025-06-27T16:18:34+00:00","og_image":[{"width":524,"height":350,"url":"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg","type":"image\/jpeg"}],"author":"Admin","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Admin","Dur\u00e9e de lecture estim\u00e9e":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#article","isPartOf":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/"},"author":{"name":"Admin","@id":"https:\/\/network360.fr\/#\/schema\/person\/0f765d2aa5031b9c6e0ff879e9622f00"},"headline":"Python \u2013 Config\u00a0Cleaner","datePublished":"2024-12-04T14:41:17+00:00","dateModified":"2025-06-27T16:18:34+00:00","mainEntityOfPage":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/"},"wordCount":1002,"commentCount":0,"publisher":{"@id":"https:\/\/network360.fr\/#organization"},"image":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#primaryimage"},"thumbnailUrl":"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg","keywords":["Debutant","Python","Script"],"articleSection":["Automatisation"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/","url":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/","name":"Nettoyage de configuration avec Python","isPartOf":{"@id":"https:\/\/network360.fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#primaryimage"},"image":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#primaryimage"},"thumbnailUrl":"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg","datePublished":"2024-12-04T14:41:17+00:00","dateModified":"2025-06-27T16:18:34+00:00","description":"Automatise le nettoyage de configuration gr\u00e2ce \u00e0 un script Python simple et efficace.","breadcrumb":{"@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#primaryimage","url":"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg","contentUrl":"https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg","width":524,"height":350,"caption":"Laptop displaying code with reflection, perfect for tech and programming themes."},{"@type":"BreadcrumbList","@id":"https:\/\/network360.fr\/index.php\/2024\/12\/04\/python-config-cleaner\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/network360.fr\/"},{"@type":"ListItem","position":2,"name":"Python \u2013 Config\u00a0Cleaner"}]},{"@type":"WebSite","@id":"https:\/\/network360.fr\/#website","url":"https:\/\/network360.fr\/","name":"Network360","description":"Network360.FR | Boostez votre carri\u00e8re r\u00e9seau : CCNA, Cisco, Automation |","publisher":{"@id":"https:\/\/network360.fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/network360.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/network360.fr\/#organization","name":"Network360","url":"https:\/\/network360.fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/network360.fr\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/network360.fr\/wp-content\/uploads\/2024\/12\/cropped-LOGO3-3_preview_rev_1-1.png?fit=501%2C410&ssl=1","contentUrl":"https:\/\/i0.wp.com\/network360.fr\/wp-content\/uploads\/2024\/12\/cropped-LOGO3-3_preview_rev_1-1.png?fit=501%2C410&ssl=1","width":501,"height":410,"caption":"Network360"},"image":{"@id":"https:\/\/network360.fr\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/network360.fr\/#\/schema\/person\/0f765d2aa5031b9c6e0ff879e9622f00","name":"Admin","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/268fa79373fa3d1db9782a1cda40eca20b34e670aede3da90a8fb05b69521bbd?s=96&d=mm&r=g","caption":"Admin"},"sameAs":["https:\/\/network360.fr"],"url":"https:\/\/network360.fr\/index.php\/author\/netadmin\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",524,350,false],"thumbnail":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271-150x150.jpg",150,150,true],"medium":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271-300x200.jpg",300,200,true],"medium_large":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",524,350,false],"large":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",524,350,false],"hd_qu_size2":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",400,267,false],"1536x1536":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",524,350,false],"2048x2048":["https:\/\/network360.fr\/wp-content\/uploads\/2025\/02\/pexels-photo-1181271-1181271.jpg",524,350,false]},"uagb_author_info":{"display_name":"Admin","author_link":"https:\/\/network360.fr\/index.php\/author\/netadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"Cr\u00e9ation d'un petit script python pour nettoyer des donn\u00e9es et cr\u00e9er un script de configuration","_links":{"self":[{"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":2,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":791,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions\/791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/media\/599"}],"wp:attachment":[{"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/network360.fr\/index.php\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}