miroir de
https://github.com/PAPAMICA/Wiki-Tech.io.git
synchronisé 2024-07-08 10:59:35 +02:00
docs: update Scripting/Python/Manip-donnees
Cette révision appartient à :
Parent
5b3f5ad9e8
révision
95c09ee9f6
|
@ -2,7 +2,7 @@
|
||||||
title: Python - Manipulation des données
|
title: Python - Manipulation des données
|
||||||
description:
|
description:
|
||||||
published: true
|
published: true
|
||||||
date: 2021-06-08T09:50:05.856Z
|
date: 2021-06-08T10:02:21.639Z
|
||||||
tags:
|
tags:
|
||||||
editor: ckeditor
|
editor: ckeditor
|
||||||
dateCreated: 2021-06-07T08:01:47.026Z
|
dateCreated: 2021-06-07T08:01:47.026Z
|
||||||
|
@ -170,6 +170,9 @@ file.close()</code></pre>
|
||||||
<p>Une méthode plus fiable, plus sécurisée sera donc d'utiliser <i>open() </i>avec <i>with. </i>Le fichier sera automatiquement fermé.</p>
|
<p>Une méthode plus fiable, plus sécurisée sera donc d'utiliser <i>open() </i>avec <i>with. </i>Le fichier sera automatiquement fermé.</p>
|
||||||
<pre><code class="language-python">with open('test.txt','r') as file:
|
<pre><code class="language-python">with open('test.txt','r') as file:
|
||||||
[...]</code></pre>
|
[...]</code></pre>
|
||||||
|
<blockquote>
|
||||||
|
<p><i><strong>Attention : </strong>On voit les deux points à la fin de la ligne. Cela implique donc d'<strong>indenter</strong> les lignes suivantes.</i></p>
|
||||||
|
</blockquote>
|
||||||
<h2>Fichier texte</h2>
|
<h2>Fichier texte</h2>
|
||||||
<h2>Fichier CSV</h2>
|
<h2>Fichier CSV</h2>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
Chargement…
Référencer dans un nouveau ticket