python-crash-course/Chapter_10/10-02_learning_c.py
2025-03-03 18:11:26 +00:00

16 lines
306 B
Python

# Exercise 10-2 Learning C
# Learning Objective: Replace words in a text file
from pathlib import Path
path = Path('Chapter_10/learning_python.txt')
contents = path.read_text()
#print(contents)
#lines = contents.splitlines()
for line in contents.splitlines():
print(line.replace('Python', 'C'))