Login and get codingWe 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.py
helps you type in the right command?$ python manage.py migrat Unknown command: 'migrat'. Did you mean migrate? Type 'manage.py help' for usage.Using Python's
difflib
this is actually not that hard to implement. Let's roll our own using another theme: file matching.Complete the
get_matching_files
function below. It takes a target directoryPath
object and filter_strstr
to match (case insensitive). If any files match exactly, return alist
with 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 emptylist
.Good luck and keep calm and code more Python!
75 out of 76 users completed this Bite.
Will you be the 76th person to crack this Bite?
Resolution time: ~50 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.17 on a 1-10 difficulty scale.
» Up for a challenge? 💪