single characterlist( glob('projectdocx'[windowspath(' :/users/al/desktop/project docx')windowspath(' :/users/aldesktop/project docx')--snip-windowspath(' :/users/al/desktop/project docx')the glob expression 'projectdocxwill return 'project docxor 'project docx'but it will not return 'project docx'because only matches to one character--so it will not match to the two-character string ' finallyyou can also combine the asterisk and question mark to create even more complex glob expressionslike thislist( glob('? ?'[windowspath(' :/users/al/desktop/calc exe')windowspath(' :/users/aldesktop/foo txt')--snip-windowspath(' :/users/al/desktop/zzz txt')the glob expression '? ?will return files with any name and any three-character extension where the middle character is an 'xby picking out files with specific attributesthe glob(method lets you easily specify the files in directory you want to perform some operation on you can use for loop to iterate over the generator that glob(returnsp path(' :/users/al/desktop'for textfilepathobj in glob('txt')print(textfilepathobjprints the path object as string do something with the text file :\users\al\desktop\foo txt :\users\al\desktop\spam txt :\users\al\desktop\zzz txt if you want to perform some operation on every file in directoryyou can use either os listdir(por glob('*'checking path validity many python functions will crash with an error if you supply them with path that does not exist luckilypath objects have methods to check whether given path exists and whether it is file or folder assuming that variable holds path objectyou could expect the following calling exists(returns true if the path exists or returns false if it doesn' exist calling is_file(returns true if the path exists and is fileor returns false otherwise