Completed 10-2 Learning C
This commit is contained in:
parent
ee9b99e138
commit
03d91eeb6e
15
Chapter_10/10-02_learning_c.py
Normal file
15
Chapter_10/10-02_learning_c.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# 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 lines:
|
||||||
|
print(line.replace('Python', 'C'))
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user