Easy Syntax in Python : __STR__ Vs __REPR__ Functions

Publié le: 05 octobre 2020
sur la chaîne: Bek Brace
11,221
222

In this 3 minutes video , you will understand the main difference between the _str_ and the _repr_ built-in Python methods.

Both the str() and repr() functions are used for string representation of a Python object, in Python version 2 you had to use print followed by str or repr, but in Python 3 you can directly use str() or repr().
the _str_ and _repr_ are methods to be used inside a user defined class, while the str() and repr() functions can be used outside classes for conversion purposes.

p.s. : For simplicity, I used function and method interchangeably but to be precise _str_ and _repr_ are ,in fact, methods.

DEV profile : https://dev.to/bekbrace
Github profile: https://github.com/BekBrace


Sur cette page du site, vous pouvez voir la vidéo en ligne Easy Syntax in Python : __STR__ Vs __REPR__ Functions durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Bek Brace 05 octobre 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 11,221 fois et il a aimé 222 téléspectateurs. Bon visionnage!