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 |
Write a regular expression that will accept an email id. Use the re module.
Is python list an array?
What is a character?
Why is button parameter “command” executed when declared?
What do you understand by the process of compilation and linking in python?
What is the lambda?
What is the use of isupper keyword in python?
Does pandas recognize dates when importing data?
What is the difference between a function and a method python?
How to redirect stdout to a file in python?
What does the meaning of slicing in python?
Explain how to overload constructors (or methods) in Python.