← Go Back
On Linux/macOS:
How to Run Python Code Without a Script
Passing the-c
option followed by the code to execute when invoking the interpreter. For example, on Windows:py -c "print('Hello, world!')"
On Linux/macOS:
python -c "print('Hello, world!')"
🐍 You might also find interesting: