Python is a document processing format string __doc__ Note aligned

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

Documentation strings in Python is a very good quality to enhance the delivery of code, written document feature convenient, but note that when you use the string, the string that identifies the document quotes must comply with the rules of indentation, otherwise Python syntax checking when will not pass, and content within the quotation marks to indent no requirement, the key is being given at this time and can not pinpoint the Python documentation string section, but is positioned to follow the code section, people can not quickly locate.
We look Case:
1, the document quotes a string of top grid write
Here Insert Picture Description
syntax error, and interpreter using the red blocks mark the wrong location marked in yellow, this position is not really wrong position
2, the document class defines string indented one more than space
Here Insert Picture Description
syntax error and error location marked with a red stripe, this position is not really wrong position
3, the document quotes a string of normal indentation, content abnormal indentation
Here Insert Picture Description
can see everything is normal.

About the contents of the document, refer to the string:
"The first 8.19 __doc__ access using Python documentation string (DocStrings)"

Old ape Python, with the old ape learn Python!
Blog address: https: //blog.csdn.net/LaoYuanPython

welcome to point praise, attention and processing comments!

Guess you like

Origin blog.csdn.net/LaoYuanPython/article/details/94749814