script
A script is a program, usually short, written to be run directly by an interpreter rather than compiled ahead of time into a standalone executable. Scripts automate work that a person would otherwise do by hand, and they typically begin executing at the first line of source code rather than at a designated entry point.
The line between a script and a full application is about use and scale, not a hard technical rule. The same language can serve both a throwaway script and a large program, so the label describes how code is used rather than what it can do.
A script tends to be small and single-purpose, written and run in quick cycles because no separate build step sits between editing the code and seeing it work.
Common roles for scripts include the following:
- Automation, replacing a repetitive manual procedure such as renaming files or transforming data.
- Glue code, connecting separate programs so they work together as a pipeline.
- Embedded control, driving a host application from within it, as build tools and game engines allow.
The term traces back to batch processing on early mainframes, where a job script listed commands for a machine to run unattended. Languages built with scripting in mind, including Python and Bash, keep that emphasis on quick, direct execution.
Related Resources
Tutorial
How to Run Your Python Scripts and Code
Learn how to run Python scripts from the command line, REPL, IDEs, and file managers on Windows, Linux, and macOS. Master all execution approaches.
For additional information on related topics, take a look at the following resources:
- How Can You Structure Your Python Script? (Tutorial)
- Executing Python Scripts With a Shebang (Tutorial)
- Python Command-Line Arguments (Tutorial)
- Build Command-Line Interfaces With Python's argparse (Tutorial)
- Modern Web Automation With Python and Selenium (Tutorial)
- Python Web Applications: Deploy Your Script as a Flask App (Tutorial)
- 4 Techniques for Testing Python Command-Line (CLI) Apps (Tutorial)
- How to Run a Python Script (Course)
- How to Run Your Python Scripts (Quiz)
- Structuring Your Python Script (Course)
- How Can You Structure Your Python Script? (Quiz)
- Execute Your Python Scripts With a Shebang (Course)
- Command Line Interfaces in Python (Course)
- Building Command Line Interfaces With argparse (Course)
- Build Command-Line Interfaces With Python's argparse (Quiz)
- Web Automation With Python and Selenium (Quiz)
- Deploy Your Python Script on the Web With Flask (Course)