Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita725875

Browse files
committed
Add solutions for Ch 11 Section 2 exercises
1 parenta694753 commita725875

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+
frompathlibimportPath
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)

[8]ページ先頭

©2009-2025 Movatter.jp