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...
-
4:44:18
CassaiyanGaming
5 hours agoArena Breakout: Infinite Dawg
26.8K2 -
2:24:32
vivafrei
15 hours agoEp. 284: Ostrich Crisis Continues! Kirk Updates! Fed-Surrection Confirmed? Comey Indicted! AND MORE!
136K204 -
5:05:18
Cewpins
5 hours agoSunday Sesh!🔥Rumble Giveaway Tonight!🍃420💨!MJ !giveaway
29.9K18 -
3:03:11
Conductor_Jackson
7 hours agoLet’s Play BioShock Infinite Burial at Sea Episode 2!
30K1 -
5:21:16
EricJohnPizzaArtist
6 days agoAwesome Sauce PIZZA ART LIVE Ep. #63: Charlie Sheen
58.5K4 -
2:36:59
THOUGHTCAST With Jeff D.
5 hours ago $0.20 earnedTHOUGHTCAST Jeff and Keegan play Left 4 Dead 2. Classic games
27.5K1 -
2:43:09
putther
9 hours ago $5.81 earned⭐ GTA ONLINE BOUNTIES THEN GTA IV ❗
70.4K4 -
6:31:38
GritsGG
12 hours agoQuad Win Streaks!🫡 Most Wins in WORLD! 3600+
71.9K1 -
1:20:13
Sports Wars
17 hours agoCollege Football UPSETS, MLB Playoff Drama, NFL Week 4
119K15 -
LIVE
Spartan
9 hours agoOMiT Spartan | Watching TSM 5K with chat + Black Myth Wukong + Ranked on Infinite Maybe
277 watching