hidemyname
hidemyname

Reputation: 4287

In python,how to output all the files name with the same extension in a directory?

I want to output the files name by using ~/*.java command. I can check if it is a java file but I really don't know how to output and read all the files by *.java command.

Upvotes: 1

Views: 68

Answers (1)

Ashwini Chaudhary
Ashwini Chaudhary

Reputation: 250881

Use the glob module:

import glob
glob.glob('*.java')

Upvotes: 6

Related Questions