Skip to content

Instantly share code, notes, and snippets.

@opethe1st
Last active June 23, 2018 21:37
Show Gist options
  • Save opethe1st/9145e95388fe2bb9a27468f6b158ea95 to your computer and use it in GitHub Desktop.
Save opethe1st/9145e95388fe2bb9a27468f6b158ea95 to your computer and use it in GitHub Desktop.
import re
import os
import sys
for directory in sys.path:
for directory, subDirectories, files in os.walk(directory):
for file in files:
if file.endswith('.py'):
filepath = os.path.join(directory, file).replace('/', '.')
match = re.match(pattern='.*.site-packages.(.*)', string=filepath)
if match:
print(match.groups())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment