50 Classes and Objects in Python | Python [ COMPLETE COURSE ]

Publié le: 21 août 2020
sur la chaîne: Tech Lab
46
0

We can use the type() function to figure out what class a variable or value belongs to. For example, type(" ") tells us that this is a string class. The only attribute in this case is the string value, but there are a bunch of methods associated with the class. We've seen the upper() method, which returns the string in all uppercase, as well as isnumeric() which returns a boolean telling us whether or not the string is a number. You can use the dir() function to print all the attributes and methods of an object. Each string is an instance of the string class, having the same methods of the parent class. Since the content of the string is different, the methods will return different values. You can also use the help() function on an object, which will return the documentation for the corresponding class. This will show all the methods for the class, along with parameters the methods receive, types of return values, and a description of the methods.


Christine Rafla
Email us at - techlaboffice77@gmail.com


Sur cette page du site, vous pouvez voir la vidéo en ligne 50 Classes and Objects in Python | Python [ COMPLETE COURSE ] durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tech Lab 21 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 46 fois et il a aimé 0 téléspectateurs. Bon visionnage!