Login and get coding
We love it when CLI or web apps take the extra mile to be more user friendly. In this Bite you will tweak the user experience of a function yourself.
Have you noticed how Django's
migrate.pyhelps you type in the right command?$ python manage.py migrat Unknown command: 'migrat'. Did you mean migrate? Type 'manage.py help' for usage.
difflibthis is actually not that hard to implement. Let's roll our own using another theme: file matching.
get_matching_filesfunction below. It takes a target directory
Pathobject and filter_str
strto match (case insensitive). If any files match exactly, return a
listwith matches. If there is no exact match, see if there are closely matching files and return those. If no closely matching files either, return an empty
Good luck and keep calm and code more Python!