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...
-
2:34:22
TheSaltyCracker
4 hours agoDrug Smugglers Blown Up 9-03-25
71.4K151 -
3:12:59
VapinGamers
3 hours ago $0.01 earnedGrim Trials - Game Review/Playthru - Rougelight Dungeon Crawler - !rumbot !music
15.1K -
2:47:55
Mally_Mouse
10 hours ago🎮 Let's Play!! -- Jak 2 pt. 16
30.9K2 -
52:23
MattMorseTV
5 hours ago $0.63 earned🔴The Cartels are SCREWED.🔴
98.7K124 -
1:32:46
Badlands Media
19 hours agoAltered State S3 Ep. 44
41.4K1 -
21:09
Bearing
16 hours agoAustralian “Racist” Protest EXPLODES 💥 Glowies, Brawls & Media Spin 📣
22.1K31 -
2:53:23
Tundra Tactical
3 hours ago $0.01 earnedTwo Vets, One Ouija Board, Zero Good Decisions
19.6K1 -
3:49:59
Barry Cunningham
9 hours agoPAM BONDI & KRISTI NOEM HOST A PRESS CONFERENCE AND JOHN RICH JOINS THE SHOW!
42.3K35 -
9:26:16
GrimmHollywood
13 hours ago🔴LIVE • GRIMM HOLLYWOOD • RETRO PS2 GAMES • GRIMMDY GAMES • BRRRAP PACK x FINALS RANKED GRIND
19.7K -
LIVE
Cripiechuccles
10 hours ago😁18+💚💙WEEDIE WED WITH CRIPIE💚RUMLUV💙👌SMOKING, GAMING & WATCHING FLICKS!:😁
58 watching