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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy