Python 基础 —— from future import

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                       
  • 这是 python 2 的概念,显然 python 3 对于 python2 就是 future了
  • 该句必须治愈文件的头部

from __future__ import print_function

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

from __future__ import print_functionimport sysprint('error happens!', file=sys.stderr)
   
   
  • 1
  • 2
  • 3
           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/hftytf/article/details/83905147