- Table of Contents
-
- 01-Fundamentals Command Reference
- 00-Preface
- 01-CLI commands
- 02-RBAC commands
- 03-Login management commands
- 04-FTP and TFTP commands
- 05-File system management commands
- 06-Configuration file management commands
- 07-Software upgrade commands
- 08-ISSU commands
- 09-Device management commands
- 10-Tcl commands
- 11-Password recovery control command
- 12-Python commands
- 13-License management commands
- Related Documents
-
Title | Size | Download |
---|---|---|
12-Python commands | 57.86 KB |
Python commands
exit()
Use exit() to exit the Python shell.
Syntax
exit()
Views
Python shell
Predefined user roles
network-admin
Usage guidelines
To return to user view from the Python shell, you cannot use the quit command. You must use the exit() command.
Examples
# Exit the Python shell.
Python 2.7.3 (default, Apr 10 2014, 16:30:23)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
<Sysname>
python
Use python to enter the Python shell.
Syntax
Views
User view
Predefined user roles
Usage guidelines
In the Python shell, you can use the following items:
· Python 2.7 commands.
· Python 2.7 standard API.
· Comware 7 extended API.
Examples
Python 2.7.3 (default, Apr 10 2014, 16:30:23)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
python filename
Use python filename to execute a Python script.
Syntax
python filename [ param ]
Views
User view
Predefined user roles
Parameters
Usage guidelines
You cannot perform any operations while a Python script is being executed by your command.
Make sure the statements in the script meet the syntax requirements. The system stops executing a Python script if it finds a statement with syntax errors.
Examples
# Execute the Python script test.py.
['/flash:/test.py', '1', '2']