get name of a file in python

Solutions on MaxInterview for get name of a file in python by the best coders in the world

showing results for - "get name of a file in python"
Irene
05 Nov 2018
1>>> f = open('/tmp/generic.png','r')
2>>> f.name
3'/tmp/generic.png'
4>>> import os
5>>> os.path.basename(f.name)
6'generic.png'