问题描述:

I am trying to figure out why I am receiving the following syntax error on my Python print statement in Eclipse:

 print(md5_to_hex(md5(message)),' <= "',message.decode('ascii'),'"', sep='')

^

SyntaxError: invalid syntax

网友答案:
from __future__ import print_function

Print isn't a function yet, import the future version of print to get it to behave this way.

网友答案:

In python-2.x

print(whatever)

is roughly* equivalent to

print whatever

In your case, whatever is

md5_to_hex(md5(message)),' <= "',message.decode('ascii'),'"', sep=''

which is not a valid expression.

* (That's not true if (whatever) is a tuple)

相关阅读:
Top