16 lines
263 B
Python
16 lines
263 B
Python
# Exercise 10-1 Learning Python
|
|
# Learning Objective: Read from 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)
|
|
|