1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] python giving AttributeError

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024 às 19:52.

  1. Stack

    Stack Membro Participativo

    this is my problem :

    class Student :
    def __init__(self,name):
    self.__name = name
    def __print(self):
    print(self.name)
    st = Student("amir")
    st.__print()

    • My platform is Windows 10
    • I used IDE VS Code

    [​IMG]

    I was defining an object called Student for my class and I wanted to define the print method for this object as private, but I cannot call this method and when executing the command, Python gives me AttributeError.

    Continue reading...

Compartilhe esta Página