Premium Only Content
This video is only available to Rumble Premium subscribers. Subscribe to
enjoy exclusive content and ad-free viewing.
Python - How to get file name from file path
1 year ago
2
How to get file name from file path in python
To extract the file name from a file path in Python, you can use the os.path.basename function from the os module or the Path.name attribute from the pathlib module.
Here's how you can do it with both methods
Using os.path.basename function
import os
file_path = '/path/to/your/file.txt'
file_name = os.path.basename(file_path)
print(file_name)
Loading comments...
-
1:03:23
Tactical Advisor
11 hours agoNew Gun Unboxing | Vault Room Live Stream 044
214K33 -
19:12
Robbi On The Record
12 hours ago $0.11 earnedThe Loneliness Epidemic: AN INVESTIGATION
56K89 -
14:45
Mrgunsngear
1 day ago $6.26 earnedFletcher Rifle Works Texas Flood 30 Caliber 3D Printed Titanium Suppressor Test & Review
97.8K26 -
17:17
Lady Decade
1 day ago $0.42 earnedMortal Kombat Legacy Kollection is Causing Outrage
63.9K10 -
35:51
Athlete & Artist Show
1 day ago $12.35 earnedIs Ryan Smith The Best Owner In The NHL?
82.3K8 -
22:56
American Thought Leaders
2 days agoCharles Murray: I Thought Religion Was Irrelevant to Me. I Was Wrong.
68.7K39 -
36:22
Brad Owen Poker
13 hours agoGIGANTIC $17,000+ Pot In BOBBY’S ROOM! TRAPPING Top Pro w/FULL HOUSE!! Big Win! Poker Vlog Ep 326
74.4K6 -
3:53
GreenMan Studio
1 day agoRUMBLE RUNDOWN: DREAM HACK SPECIAL W/Greenman Reports
60.7K12 -
1:28
Damon Imani
2 days agoThey Laughed at Trump’s Cognitive Test — Damon Made Them REGRET It!
58.6K39 -
9:14
Freedom Frontline
1 day agoAdam Schiff PANICS As Eric Schmitt Exposes His Dirty Lies LIVE
39.7K82