Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d879b4 commit 75c8f46Copy full SHA for 75c8f46
useful_scripts/find_file.py
@@ -0,0 +1,18 @@
1
+# Sebastian Raschka 2014
2
+#
3
+# A Python function to find files in a directory based on a substring search.
4
+
5
6
+import os
7
8
+def find_files(substring, path):
9
+ results = []
10
+ for f in os.listdir(path):
11
+ if substring in f:
12
+ results.append(os.path.join(path, f))
13
+ return results
14
15
+# E.g.
16
+# find_files('Untitled', '/Users/sebastian/Desktop/')
17
+# returns
18
+# ['/Users/sebastian/Desktop/Untitled0.ipynb']
0 commit comments