python中print(.__doc__)和print(.__init__.__doc__)分别是什么?

python中print(.doc)和print(.init.doc)分别是什么?

print(print.__doc__)

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.
flush: whether to forcibly flush the stream.



print(print.__init__.__doc__)

Initialize self.  See help(type(self)) for accurate signature.

Python有个特性叫做文档字符串,即DocString,这个特性可以让你的程序更加清晰易懂,在Python的系统文件里,也都在使用这个特性。
DocString是有自己的格式的。一般是放在自己函数定义的第一行,用 " 符号表示,在这 " 里面添加函数功能说明就可以了。这个说明可以使用 .doc (注意前后都是双__),将DocString特性print打印出来。
DocString的典型用法就是help()调用,它抓取DocString属性,清晰的给你展示出来。

__doc__:文档字符串,模块本身是一个对象,而对象都会有一个__doc__属性,该属性用于描述该模块的作用。
详细可参考: https://www.cnblogs.com/sticker0726/p/7892159.html