Exercice Python: Remplacer les 24 premiers caractères d'un fichier texte eb Python - Python 2.7 3.8 version Windows 7, Windows 8 , Windows 10...
Nous alons voir dans cette vidéo comment remplacer les 24 premiers caractères d'un fichier en python : on procède de la manière suivante:
- ouvrir le fichier en mode lecture read.
- récupérer le contenu du fichier sous forme de chaine de caractère via la méthode read.
- supprimer les 24 pemiers caractères du fichier et les remplacer par le nouveau contenu
- on ouvre ensuite le fichier en mode écriture : write et on insère le nouveau contenu.
Pour un bon visionage de la vidéo, utiliser la dernière version du navigateur web Google Chrome.
Python exercise: Replace the first 24 characters of a Python eb text file - Python 2.7 3.8 version Windows 7, Windows 8, Windows 10 ...
We will see in this video how to replace the first 24 characters of a file in python: we proceed as follows:
- open the file in read read mode.
- recover the content of the file in the form of a character string via the read method.
- delete the first 24 characters from the file and replace them with the new content
- then open the file in write mode: write and insert the new content.
For a good viewing of the video, use the latest version of the Google Chrome web browser.