Re: help with simple print statement!

2012-08-26 Thread Hans Mulder
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
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: help with simple print statement!

2012-08-24 Thread Bruce Krayenhoff
Thank-you all, it works now!


Best Wishes,

 Bruce
 C: 604-441-5791
 
<https://www.google.com/calendar/embed?src=ecuiatvm07anmj3ch314if3gns%40grou
p.calendar.google.com&ctz=America/Vancouver> My Availability 

 

From: python-list-bounces+wbrucek=gmail@python.org
[mailto:python-list-bounces+wbrucek=gmail@python.org] On Behalf Of Chris
Kaynor
Sent: August-24-12 12:54 PM
To: python-list@python.org
Subject: Re: help with simple print statement!

 

On Fri, Aug 24, 2012 at 12:43 PM, Willem Krayenhoff mailto:wbru...@gmail.com> > wrote:

Any idea why print isn't working here?  

 

I tried restarting my Command prompt.  Also, print doesn't work inside a
class.

 

 

 

In Python 3, print was made into a function rather than a statement for
various reasons (I'll leave it to the reader to find sources as to why). You
just need to call it rather than use it as a statement.

 

-- 
Best Wishes,

 Bruce
 C: 604-441-5791  
 My Availability
<https://www.google.com/calendar/embed?src=ecuiatvm07anmj3ch314if3gns%40grou
p.calendar.google.com&ctz=America/Vancouver>  


--
http://mail.python.org/mailman/listinfo/python-list

 

-- 
http://mail.python.org/mailman/listinfo/python-list


proper reply format [was Re: help with simple print statement!]

2012-08-24 Thread Ethan Furman

Prasad, Ramit wrote:

Willem Krayenhoff
Any idea why print isn't working here?  


I tried restarting my Command prompt.  Also, print doesn't work inside a class.




Ramit,

The standard for attribution is something along the lines of:

Prasad, Ramit wrote:

or

Willem Kayenhoff wrote:

Just having Willem's name at the top was confusing.  Also, because you 
didn't trim his signature, the rest of your reply looked like a 
signature to Thunderbird (which uses a line of '--' to figure the start 
of signatures).  As you can see, the rest of your post was trimmed away 
as signature lines when I hit Reply.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


RE: help with simple print statement!

2012-08-24 Thread Prasad, Ramit

Willem Krayenhoff
Any idea why print isn't working here?  

I tried restarting my Command prompt.  Also, print doesn't work inside a class.


-- 
Best Wishes,

     Bruce
     C: 604-441-5791
     My Availability 



Just as a note, this is a usenet group that can be accessed via email; a good 
portion of the people on the list does not receive attachments and images. HTML 
is also a bad format as it mangles code so please post in plain text and 
copy/paste from the command line instead of using screenshots.  It will be easy 
for us to run your code if necessary to reproduce the results.

Now on to your problem. You are using Python 3 where print was turned from a 
statement into a function. You need to use the following instead. 

print('34ki') 
print(6)
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with simple print statement!

2012-08-24 Thread Zero Piraeus
:

On 24 August 2012 15:43, Willem Krayenhoff  wrote:
> Any idea why print isn't working here?

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function

Also, pasting images into emails to this list is unlikely to gain you
many friends ...

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with simple print statement!

2012-08-24 Thread Rob Day
On Fri, 2012-08-24 at 12:43 -0700, Willem Krayenhoff wrote:
> Any idea why print isn't working here?  

You're using Python 3.2, but trying Python 2.7 syntax -
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function 
should explain the problem adequately.

(Incidentally - you can copy from the Windows console by right-clicking
and selecting "Mark". It's a little easier than taking a screenshot!)

Rob




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with simple print statement!

2012-08-24 Thread Chris Kaynor
On Fri, Aug 24, 2012 at 12:43 PM, Willem Krayenhoff wrote:

> Any idea why print isn't working here?
>
> I tried restarting my Command prompt.  Also, print doesn't work inside a
> class.
>
> [image: Inline image 2]
>

In Python 3, print was made into a function rather than a statement for
various reasons (I'll leave it to the reader to find sources as to why).
You just need to call it rather than use it as a statement.


> --
> Best Wishes,
>
>  Bruce
>  C: 604-441-5791
>  My 
> Availability
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
<>-- 
http://mail.python.org/mailman/listinfo/python-list