[Tutor] print string

Alan Gauld alan.gauld at btinternet.com
Mon Aug 18 00:30:27 CEST 2014


On 17/08/14 14:11, Sajjadul Islam wrote:
> Hello forum,
>
> I have started working with python 2.7.6 and i am trying to print the
> following string value:
>
> print("Same", "message", "as before")

Looks like you are using a Python v3 tutorial on Python 2.7.
The syntax of printing changed a lot in Python 3.

The good news is that you can fake it in Python 2.7 by adding
the line:

from __future__ import print_function

at the start of your session/program.
Then you get Python3 style printing in 2.7.

HTH

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list