List comprehension - list files with extension in a directory

50

List comprehension - list files with extension in a directory -

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

Comments

Submit
0 Comments