What is the procedure to extract values from the object used in python?
Answer Posted / chaitanya
To extract the value it requires the object type to be defined and according to the object type only the values will be fetched. The values will be extracted as:
• If the object is a tuple then PyTuple_Size() method is used that returns the length of the values and another method PyTuple_GetItem() returns the data item that is stored at a specific index.
• If the object is a list then PyListSize() is having the same function that is defined for the tuple and PyList_GetItem() that also return the data items at a specified index.
• Strings uses PyString_Size() to return the length of the value and PyString_AsString() that return the pointer to its value.
• To check the type of the object and the extracted values use of methods like PyString_Check(), PyTuple_Check(), PyList_Check(), etc are used.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of a // operator?
What does the list comprehension do?
Does python has classes?
Why anaconda is used for python?
Which database is best with python?
What is import time in python?
What is defined isalpha() in python?
Why you should learn python in 2019?
What is the output of the following code and why?
How do you remove the leading whitespace in a string in python?
What is yield in python?
What is sys stdout flush ()?
What does means by “call by reference” in python?
Is python 0 based?
How to convert a list into a set?