Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How is Multithreading achieved in Python?

968


What is GIL? What does it do?Talk to me about the GIL. How does it impact concurrency in Python? What kinds of applications does it impact more than others?

852


What are the basic datatypes in python?

1071


What is the meaning of @classmethod and @staticmethod ?

974


How do I convert time to seconds in python?

809


A module print_number given, what will be the output of the following code?

865


What is python inheritance?

842


What are classes in python?

809


Mention the floor division available in python

893


How to generate random numbers in python?

1086


What are tuples in python?

945


Which server is best for python?

904


What does do in python?

894


What is the purpose of not in operator?

983


What is the use of ‘self’ keyword in python?

892