Skip to content

Instantly share code, notes, and snippets.

@sohang3112
Created April 22, 2022 11:58
Show Gist options
  • Save sohang3112/9b12491b005434fb33467a3bc027ab40 to your computer and use it in GitHub Desktop.
Save sohang3112/9b12491b005434fb33467a3bc027ab40 to your computer and use it in GitHub Desktop.
Keep opening random stdlib modules' documentation in browser while user wants to continue
import sys
import random
import webbrowser
mods = list(sys.stdlib_module_names)
random.shuffle(mods)
for mod in mods:
if mod[0] == '_': # Skip Internal Modules
continue
webbrowser.open(f'https://docs.python.org/3/library/{mod}.html')
if input('Continue? (y|n)> ').strip().lower() != 'y':
break
@sohang3112
Copy link
Author

Note: This will fail for some modules (eg. pstats) that don't have their own Python 3 Documentation page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment