0 votes
in Python by
What is the procedure to extract values from the object used in python?

1 Answer

0 votes
by

To extract the value it requires the object type to be defined and the values are fetched according to the object type.

The values are extracted as:

- If the object is a tuple then PyTuple_Size() method is used that returns the length of the values and the method PyTuple_GetItem() returns the data item stored at a specific index.

- If the object is a list then PyListSize() and PyList_GetItem() perform the same function as they are for tuple.

- Strings use PyString_Size() to return the length of the value and PyString_AsString() returns the pointer to its value.

- To check the type of the object and the extracted values, methods like PyString_Check(), PyTuple_Check(), PyList_Check(), etc are used.

Related questions

0 votes
asked Feb 9, 2021 in JAVA by SakshiSharma
0 votes
asked Jun 25, 2022 in Django by sharadyadav1986
...