Python 基础 —— from __future__ import

来源:互联网 发布:xperia touch 知乎 编辑:程序博客网 时间:2024/06/06 03:28
  • 这是 python 2 的概念,显然 python 3 对于 python2 就是 future了
  • 该句必须治愈文件的头部

from __future__ import print_function

指定 file 关键字参数,打印到文件流当然也可以是标准输入输出流

from __future__ import print_functionimport sysprint('error happens!', file=sys.stderr)
0 0