Python Interpreter
This online tool provides a Python interpreter for executing Python code. It supports both Python 2 and Python 3.
Running Python Code
Below are some examples of how to use the Python interpreter. You can copy and paste these commands into your terminal or command prompt.
Basic Web Server
# Python v2.7
python -m SimpleHTTPServer
# Python 3
python -m http.server 8000
This will start a simple web server in the current directory.
SMTP Debugging Server
# SMTP-Server for debugging, messages will be discarded, and printed on STDOUT.
python -m smtpd -n -c DebuggingServer localhost:1025
This starts an SMTP server useful for debugging email sending. Messages are discarded and printed to the console.
JSON Pretty Printing
# Pretty print a JSON
python -m json.tool
This command uses the json.tool module to format JSON data.
Zen of Python
# Zen of Python
python -m this
This displays the "Zen of Python," a collection of guiding principles for Python programming.
Further Resources
For more information on Python, check out these resources: