Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to use glob.escape() function in python

import glob

files = glob.glob("D:***.jpg",recursive=True)
# All jpg files
print(files)

#JPEGs files with special characters in their name
# set of special characters _, $, #
char_seq = "_$#"
for char in char_seq:
    results = "*" + glob.escape(char) + "*" + ".jpg"
    for file in (glob.glob(results)):
        print(file)

Comment

PREVIOUS NEXT
Code Example
Python :: generate pycryptodome salt 
Python :: python is x string methods 
Python :: python typing optional argument 
Python :: fetch metric data from aws boto3 
Python :: python subprocess call with no environment variable 
Python :: list expression inside bracket python 
Python :: Python NumPy atleast_3d Function Syntax 
Python :: Python NumPy rollaxis Function Example 02 
Python :: no definition 
Python :: python read file with class 
Python :: python generate string of length 
Python :: codeforces problem 200B 
Python :: Python NumPy row_stack Function Syntax 
Python :: verbose field names 
Python :: python increase a value every n rows 
Python :: model compile keras 
Python :: NumPy trim_zeros Syntax 
Python :: how to split a string every 2 characters python 
Python :: NumPy unpackbits Code Unpacked array along default axis 
Python :: Termfastapi get ip 
Python :: ExpressionalRebel 
Python :: Creating a Nested Dictionary 
Python :: manager.dict() append 
Python :: List change after copy Python 
Python :: python readlines  
Python :: python event emitter 
Python :: Flask error: werkzeug.routing.BuildError 
Python :: EDA describe missing and zero values 
Python :: ring Loop Command 
Python :: candelstick chart matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =