- Table of Contents
-
- 01-Fundamentals
- 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-Device management commands
- 09-Tcl commands
- 10-Python commands
- 11-License management commands
- Related Documents
-
Title | Size | Download |
---|---|---|
10-Python commands | 61.21 KB |
Python commands
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 V7 extended API.
To return to user view from the Python shell, enter exit().
Examples
Python 2.7.3 (default, Dec 22 2012, 11:39:05)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
<Sysname>
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 Python script test.py.
['/flash:/test.py', '1', '2']