135
Using Python
Comware 7 provides a built-in Python interpreter that supports the following items:
• Python 2.7 commands.
• Python 2.7 standard API.
• Comware 7 extended API. For more information about the Comware 7 extended API, see
"Comware 7 extended Python API."
• Python script
s. 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 Command
Enter the Python shell from user view.
python
Executing a Python script
Execute a Python script in user view.
Task Command
Execute a Python script.
python
filename
Exiting the Python shell
Execute this command in the Python shell.
Task Command
Exit the Python shell.
exit()
Python usage example
Network requirements
Use a Python script to perform the following tasks:
• 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.