How do I compile my Python 3 app to an .exe?

cx_Freeze does this but creates a folder with lots of dependencies. py2exe now does this and, with the –bundle-files 0 option, creates just one EXE, which is probably the best solution to your question. UPDATE: After encountering third-party modules that py2exe had trouble “finding”, I’ve moved to pyinstaller as kotlet schabowy suggests below. Both have ample documentation … Read more

Random word generator- Python

Reading a local word list If you’re doing this repeatedly, I would download it locally and pull from the local file. *nix users can use /usr/share/dict/words. Example: Pulling from a remote dictionary If you want to pull from a remote dictionary, here are a couple of ways. The requests library makes this really easy (you’ll … Read more

Printing subscript in python

If all you care about are digits, you can use the str.maketrans() and str.translate() methods: Which will output: Note that this won’t work in Python 2 – see Python 2 maketrans() function doesn’t work with Unicode for an explanation of why that’s the case, and how to work around it.