IPythonList.SetAt

Syntax

SetAt(Index: Integer; Item: Variant);

Parameters

Index. List element index.

Item. The value that will be set to list element.

Description

The SetAt method sets value for the specified list element.

Comments

The type of the specified values must correspond to the type that has value already installed in the element.

Example

Add a link to the Python system assembly.

Sub UserProc;
Var
    pList: IPythonList;
    v: Variant;
    Arr: Array;
Begin
    
//Create a list
    pList := New PythonList.Create("A""B""C");
    Arr := pList.ToArray;
    
For Each v In Arr Do
        Debug.Write(v + 
" ");
    
End For;
    Debug.WriteLine(
"");
    
//Change value of the last element
    pList.SetAt(2, pList.Item(0) + pList.Item(1));
    Arr := pList.ToArray;
    
For Each v In Arr Do
        Debug.Write(v + 
" ");
    
End For;
End Sub UserProc;

On executing the example an object containing a Python list is created. The value of last element will be changed in the list. Values of the list elements before and after modification will be displayed to the development environment console.

See also:

IPythonList