How to import the print function from __future__ ?
I did from __future__ import print_function
print('text',end='\n')
But it shows error.
I did from __future__ import print_function
print('text',end='\n')
But it shows error.
\n
is not defined, you have to consider the string '\n'
(with quotes):
sage: print('text',end='\n')
text
I know @tmonteil but I still get the error, It was a typo actually.
It works for me. Could you please give us some informations so that someone can try to reproduce your problem:
@tmonteil hi I use ubuntu xenial. I use sagemath 7.2 latest version obviously, as I downloaded the binaries from their site for ubuntu. So the error is huge, I don't know where to paste it?
ok here is the error @tmonteil Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_3.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("cHJpbnQoJ3NmJyxlbmQ9J1xuJyk="),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>
File "/tmp/tmpKltQiS/___code___.py", line 2 print('sf',end='\n') ^ SyntaxError: invalid syntax
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-03-21 15:41:27 +0100
Seen: 753 times
Last updated: Mar 21 '17
sorry I can't edit it , as I get the error : null value in column "ip_addr" violates not-null constraint DETAIL: Failing row contains (39710, 0, 23402, 2017-03-21 11:01:36.084769-05, None, I did
from __future__ import print_function
print('text',end=..., How to import the print function from __future__ ?, import, f, 37014, f, null, null, f, null, null).Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_9.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 -*-\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zm9yIGkgaW4gMyw0LDQsMjM6CiAgICBwcmludChpLCdlcicsZW5kPScgJyk="),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>
File "/tmp/tmpd1blu3/___code___.py", line 4 print(i,'er',end=' ') ^ SyntaxError: invalid syntax*