PythonBasics Of Python
Python Editor: Sublime Text
In this lecture, we learn about Sublime Text, a lightweight and powerful code editor commonly used for writing Python programs.
Sublime Text is:
- Lightweight and cross-platform.
- Fast and efficient with minimal system requirements.
- Beginner-friendly, while still supporting advanced developer workflows.
- Available in both free and licensed versions.
- Backed by strong community support.
Why Use Sublime Text?
- Simple and easy-to-use interface for beginners.
- Cross-platform (Windows, macOS, Linux).
- Supports multiple programming languages, including Python.
- Provides features like syntax highlighting, plugins, and customization.
- Lightweight compared to full IDEs like PyCharm or VS Code.
Steps to Run Python Code in Sublime Text
Step 1: Download Sublime Text
Download the latest version of Sublime Text according to your operating system:
Download Sublime Text
Step 2: Install Sublime Text
- Run the downloaded installer.
- Follow the setup instructions to complete the installation.
Step 3: Open Sublime Text
- Launch the editor after installation.
Step 4: Write Python Code
Example:
print("Hello World")
Step 5: Configure Build System
- Go to Tools > Build System > Python. This tells Sublime to run your code using Python.
Step 6: Run the Code
- Open your saved .py file in Sublime Text.
- Press Ctrl + B (Windows/Linux) or Command + B (macOS).
- Sublime will run your code and display the result at the bottom of the editor.
Example:
Hello World
Summary
Sublime Text is an excellent choice for Python beginners due to its speed, simplicity, and ease of setup. It provides a great balance between being lightweight and offering enough features to get started with Python programming.