Easy Syntax in Python : __STR__ Vs __REPR__ Functions

Опубликовано: 05 Октябрь 2020
на канале: 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


На этой странице сайта вы можете посмотреть видео онлайн Easy Syntax in Python : __STR__ Vs __REPR__ Functions длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Bek Brace 05 Октябрь 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 11,221 раз и оно понравилось 222 зрителям. Приятного просмотра!