Hello! I'm Parin, who started studying Python.
I opened it again to review the files I made last weekend Last weekend, when I did CMD-I, I could check it on the console without any problems
Suddenly, an InvalidSyntax error appears. Can I know the solution??
print('')
print ('separator option')
print('')
print('P', 'Y', 'T', 'H', 'O', 'N', sep='/')
print('010','7777','1234', sep='-')
print('python','google.com', sep=' @ ')
Error name:
line 20 print('P', 'Y', 'T', 'H', 'O', 'N', sep='/') ^ SyntaxError: invalid syntax
invalid
Isn't it the Python version? If you have both versions installed, please check the environment variable settings.
The Python 2.7 version does not support the sep keyword. If you write "from_future_ import print_function" on the first line, it will work.
#python 2.7.15
from __future__ import print_function
import sys
print(sys.version)
print('')
print ('separator option')
print('')
print('P', 'Y', 'T', 'H', 'O', 'N', sep='/')
print('010','7777','1234', sep='-')
print('python','google.com', sep=' @ ')
#python 3.7.1
import sys
print(sys.version)
print('')
print ('separator option')
print('')
print('P', 'Y', 'T', 'H', 'O', 'N', sep='/')
print('010','7777','1234', sep='-')
print('python','google.com', sep=' @ ')
Please check it out.
Thank you.
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.