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
Nesta página do site você pode assistir ao vídeo on-line 50 Classes and Objects in Python | Python [ COMPLETE COURSE ] duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Tech Lab 21 Agosto 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 46 vezes e gostou 0 espectadores. Boa visualização!