On Tue, 8 Mar 2016 12:04 pm, Jinghui Niu wrote: > May I take this opportunity to ask a bold question for a beginner: if I > want to mimic Sublime Text's fuzzy search for a file search in given > directories, which module of these two would be more suitable? Could you > shed some insights? Thanks.
Read the documentation. See what functionality each module provides. Here is the documentation for Python 3: https://docs.python.org/3/library/glob.html https://docs.python.org/3/library/fnmatch.html and for Python 2: https://docs.python.org/2/library/glob.html https://docs.python.org/2/library/fnmatch.html Reading the source is also a great way to learn about the module, and to learn what is considered best practice in Python: https://hg.python.org/cpython/file/3.5/Lib/glob.py https://hg.python.org/cpython/file/3.5/Lib/fnmatch.py This may also be helpful: https://pymotw.com/2/glob/ https://pymotw.com/2/fnmatch/ But I shall give you a hint: the glob module imports the fnmatch module, and uses it to perform the matching. -- Steven -- https://mail.python.org/mailman/listinfo/python-list