I’m a newbie to PyDev in Eclipse.
When coding simple programs, I use print() statements regularly in order to track the values of variables. I want these values to be printed to the console but I couldn’t get any value printed in the console so far.
Here’s a simple piece of code to demonstrate what I’m trying to do.
class MyClass(object):
def __init__(self):
myClassObject= MyClass()
myClassObject.greet()
def greet(self):
print("stackoverflow is the best !!!")
I’m expecting to see the string “stackoverflow is the best !!!” in the console but when I run the code I get nothing at all. What am I supposed to do?
Thanks in advance
You have not instantiated the class. In order to produce output from what you’ve got try the following:
— REVISED —
In light of your rewritten code, you should have the following:
Your example appears to be overly complicated. You would do well to review class usage in Python for Python 2.7 or Python 3.3.