Created
April 23, 2022 11:10
-
-
Save islem-esi/f572be00517b179f436ce82350d31685 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 load_all_files(rootdir): | |
files_code = [] | |
for subdir, dirs, files in os.walk(rootdir): | |
for file in files: | |
if file.endswith('.py'): | |
with open(os.path.join(subdir, file)) as pf: | |
try: | |
code = pf.read() | |
files_code.append(code) | |
except: | |
print('encoding error') | |
return files_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment