0
class Employee:
    def __init__(self,first,last,salary):
        self.first = first
        self.last = last
        self.salary = salary
    
emp_1 = Employee("Rohan","Parab",100000)
print(emp_1)
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
  • Please read [ask] and please ask a proper question. In any case, this is most likely a duplicate of [How to print instances of a class using print()?](https://stackoverflow.com/q/1535327/2745495) – Gino Mempin May 03 '21 at 04:17

1 Answers1

0

You need to implement the __str__ method otherwise it will print (as you may have observed) the object location.

For example:

def __str__(self):
    return f"First Name: {self.first}, Last Name {self.last}, Salary {self.salary}"
Nic Laforge
  • 1,776
  • 1
  • 8
  • 14