This is an example that searches PDF files in the current directory.
import os, os.path
import re
def print_pdf (arg, dir, files):
for file in files:
path = os.path.join(dir, file)
path = os.path.normcase(path)
if re.search(r".*\.pdf", path):
print path
os.path.walk('.', print_pdf, 0)
Could anyone explain what r".*\.pdf"
means here?
Why ".*\"
?
Thanks!