Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get current file name python

import os
os.path.basename(__file__)
Comment

python get name of file

file_name = os.path.basename(file_path)
Comment

get name of a file in python

>>> f = open('/tmp/generic.png','r')
>>> f.name
'/tmp/generic.png'
>>> import os
>>> os.path.basename(f.name)
'generic.png'
Comment

python find file name

filesName = list(map(os.path.basename, glob.glob("..yourPath*txt")))
print(filesName)
Comment

how to get file name use python3

file_name = os.path.basename("file_path")
Comment

PREVIOUS NEXT
Code Example
Python :: django filter by date range 
Python :: Python list of dictionaries search 
Python :: 2d gaussian function python 
Python :: create a blank image 
Python :: python web parsing 
Python :: dataframe KeyError: 
Python :: how to play mp3 files using vlc python library 
Python :: counter python 
Python :: mailchimp send email python 
Python :: dict typing python 
Python :: how to detect when a key is pressed in pygame 
Python :: python how to draw a square 
Python :: how to change size of turtle in python 
Python :: sort columns dataframe 
Python :: how to check if a list is nested or not 
Python :: what does .shape do in python 
Python :: opencv python grayscale image to color 
Python :: python cmd exec 
Python :: matplotlib point labels 
Python :: change index of dataframe with list 
Python :: heroku python buildpack 
Python :: pyspark rdd filter 
Python :: 3d array python numpy 
Python :: how to run .exe from python 
Python :: python string vs byte string 
Python :: How to construct a prefix sum array in python? 
Python :: virtual env python 2 
Python :: convert list to dataframe 
Python :: ValueError: Found array with dim 3. Estimator expected <= 2. 
Python :: Python capitalize first letter of string without changing the rest 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =