8000 Add solutions for Ch 11 Section 2 exercises · tejussm/python-basics-exercises@a725875 · GitHub
[go: up one dir, main page]

Skip to content

Commit a725875

Browse files
committed
Add solutions for Ch 11 Section 2 exercises
1 parent a694753 commit a725875

File tree

2 files changed

+20
-53
lines changed

2 files changed

+20
-53
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 11.2 - Working With File Paths in Python
2+
# Solutions to review exercises
3+
4+
5+
# Exercise 1
6+
from pathlib import Path
7+
8+
file_path = Path.home() / "my_folder" / "my_file.txt"
9+
10+
11+
# Exercise 2
12+
print(file_path.exists())
13+
14+
15+
# Exercise 3
16+
print(file_path.name)
17+
18+
19+
# Exercise 4
20+
print(file_path.parent.name)

ch11-file-input-and-output/2-working-with-paths-in-python.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0