문제

I am trying to write this in PyScripter IDE:

def f(a):
    print a

enter image description here

and it says: Syntax Error, Invalid syntax. However if I try the same code in the Python Shell it is OK and I can see the result

enter image description here

도움이 되었습니까?

해결책

Pyscripter by default uses the latest version of python available So You are probably using python 3 on pyscripter where print is a function so instead try:

def f(a):
    print(a)

And to set pyscripter to use python 2 add this to your pyscripter shortcut edit the target field to look like:

"path_2_PyScripter.exe" --PYTHON27
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top