What is the procedure to extract values from the object used in python?
Answer / 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 |
How many functions are in python?
Will class members accessible by instances of class?
What is the language from which Python has got its features or derived its features?
Explain me what are the principal differences between the lambda and def?
Do you need python to run a python program?
What happens if an error occurs that is not handled in the except block?
Explain how to redirect the output of a python script from standout(ie., A monitor) on to a file?
What is a docstring comment?
What is python explain the advantages of using python?
What is deep copy in python?
How to clone or copy a list?
Describe how to send mail from a Python script.