Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27830 > unrolled thread
| Started by | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
|---|---|
| First post | 2012-08-24 19:59 +0000 |
| Last post | 2012-08-26 11:01 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
RE: help with simple print statement! "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-08-24 19:59 +0000
Re: help with simple print statement! Hans Mulder <hansmu@xs4all.nl> - 2012-08-26 11:01 +0200
| From | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
|---|---|
| Date | 2012-08-24 19:59 +0000 |
| Subject | RE: help with simple print statement! |
| Message-ID | <mailman.3774.1345838384.4697.python-list@python.org> |
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.
[toc] | [next] | [standalone]
| From | Hans Mulder <hansmu@xs4all.nl> |
|---|---|
| Date | 2012-08-26 11:01 +0200 |
| Message-ID | <5039e5e3$0$6917$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #27830 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web