Created
February 7, 2017 20:03
-
-
Save serashioda/364d6c86c3c117f413bbce6661199e55 to your computer and use it in GitHub Desktop.
Find the Path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_path(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```Write a function that takes a file path as the first argument, and a file extension as an optional second argument. | |
If the file extension is not None, then traverse the given file path looking for all instances of files with that extension. | |
SO… | |
If extension = ".py" and filepath = "/home/Nick/" | |
Return the absolute path to every file ending in that extension | |
/home/Nick/foo.py | |
/home/Nick/django_stuff/manage.py | |
/home/Nick/django_stuff/blog/models.py | |
If extension IS none, then return all file paths in subtrees | |
Submit the link to your gist to my email (nicholas@codefellows.com) by 12:30 pm | |
``` | |
If it would help, you can use any data structure you’ve written thus far |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment