Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 2.7 print() error

I have a strange error using sep, file, (etc.) arguments of python's print() function. I tried to google it out, dag around stackoverflow, and read python's documentation but I came up with nothing. I have attached a simple snippet, I would deeply appreciate any help.

# python
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print("blah"*10, sep=" | ")
  File "<stdin>", line 1
    print("blah"*10, sep=" | ")
                        ^
SyntaxError: invalid syntax
like image 947
Mr. Avatar asked Jul 27 '12 09:07

Mr.


1 Answers

Try:

from __future__ import print_function

first

like image 129
cdarke Avatar answered Oct 04 '22 02:10

cdarke