Answers for "how to use glob python"

5

python glob

import glob

print 'Named explicitly:'
for name in glob.glob('dir/subdir/*'):
    print 't', name

print 'Named with wildcard:'
for name in glob.glob('dir/*/*'):
    print 't', name
Posted by: Guest on October-23-2020
1

How to use Python Glob Module

import glob
# path of the current directory
path = '.'
curfiles = glob.glob(path + '/*.html')
for file in curfiles:
    print(file)
Posted by: Guest on August-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language