那是因为在Python 3中,他们用 函数 替换了该
现在的语法与以前差不多,但是需要parens:
从“ python 3新增功能”文档中:
Old: print "The answer is", 2*2New: print("The answer is", 2*2)Old: print x,# Trailing comma suppresses newlineNew: print(x, end=" ") # Appends a space instead of a newlineOld: print # Prints a newlineNew: print() # You must call the function!Old: print >>sys.stderr, "fatal error"New: print("fatal error", file=sys.stderr)Old: print (x, y) # prints repr((x, y))New: print((x, y)) # Not the same as print(x, y)!


