help with simple print statement!
Hans Mulder
hansmu at xs4all.nl
Sun Aug 26 05:01:23 EDT 2012
On 24/08/12 21:59:12, Prasad, Ramit wrote:
> Also, print doesn't work inside a class.
It works for me:
> python3
Python 3.3.0a1 (v3.3.0a1:f1a9a6505731, Mar 4 2012, 12:26:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class spam(object):
... print("Hello there!")
...
Hello there!
>>>
I'm not sure why you'd want to call the print function in a
class definition, though. The print function is more usually
called from within a method definition, not at the class level.
What, exactly are you doing?
Are you trying python2 syntax in a python3 interpreter, or vice versa?
Can you copy a complete session and paste it into a follow-up message?
-- HansM
More information about the Python-list
mailing list