Using Python
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and
a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic
typing, together with its interpreted nature, make it an ideal language for scripting and rapid application
development in many areas on most platforms.
Comware V7 provides a built-in Python interpreter that supports the following items:
Python 2.7 commands.
•
Python 2.7 standard API.
•
Comware V7 extended API. For more information about the Comware V7 extended API, see
•
"Comware V7 extended Python
Python scripts. You can use a Python script to configure the system.
•
Entering the Python shell
To use Python commands and APIs, you must enter the Python shell.
Task
Enter the Python shell from user view.
Executing a Python script
Execute a Python script in user view.
Task
Execute a Python script.
Python usage example
Network requirements
Use a Python script to download configuration files main.cfg and backup.cfg to the device. Configure the
files as the main and backup configuration files for the next startup.
Figure 39 Network diagram
API."
Command
python
Command
python filename
159