Technology Sharing

python-23-Zero-based self-study of python open() and replace() functions

2024-07-08

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Learning content: Exercise 10-2 of the second edition of "Python Programming: From Entry to Practice"

Knowledge points:

Open the file, replace() replaces the file content, open(),

Exercise content:

Exercise 10-2: C language learning notes You can use the replace() method to replace a specific word in a string with another word. Read each line in the learning_python.txt file you just created and replace Python with the name of another language, such as C. Print each modified line to the screen.

My code