开始学习python,直接从python3开始学习了,虽然相应的库和资料还比较少,据说python3是一次大改动吧。看了一些python2.x的资料,在python3 shell中实现的时候,发现python3中对print函数做了较大的修改:

 

>>> help('''print''')
Help on built
-in function print in module builtins:

print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout)

Prints the values to a stream,
or to sys.stdout by default.
Optional keyword arguments:
file: a file
-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.

最简单的,在python2.x中,可以使用print 'this is a string'这种用法,但在python3中就不行了。这看起像是在python2中,print是个关键字什么的,还不算是函数,而到了python3中,print变成了build-in函数?

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-11-23
  • 2022-12-23
  • 2021-08-01
相关资源
相似解决方案