Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

List comprehension - list files with extension in a directory

a = [name for name in os.listdir(".") if name.endswith(".txt")]
Comment

PREVIOUS NEXT
Code Example
Python :: pandas to_csv append 
Python :: plt off axis 
Python :: how to write to an output file in pytion 
Python :: how to print right angle triangle in python 
Python :: pprint python 
Python :: pandas remove index column when saving to csv 
Python :: pandas multiple string contains 
Python :: how to count stopwords in df 
Python :: href in selenium 
Python :: hello worldpython 
Python :: python split string capital letters 
Python :: seaborn increace figure size 
Python :: mean deviation python 
Python :: how to get the angle of mouse from the center 
Python :: how to delete print statement from console pythonn 
Python :: python input comma separated values 
Python :: how to rotate x axis labels in subplots 
Python :: change the default python version mac 
Python :: sort list by attribute python 
Python :: Import "decouple" could not be resolved Pylance 
Python :: random .randint renpy 
Python :: python method to filter vowels in a string 
Python :: how to order randomly in django orm 
Python :: return the count of a given substring from a string python 
Python :: random numbers in python 
Python :: set axis ticks matplotlib 
Python :: pygame center text in rect 
Python :: how to open file explorer in python 
Python :: run every minute python 
Python :: binary to text python 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =