如何在python中编写内联注释

有没有在python中结束单行注释的方法?

就像是

/*This is my comment*/ some more code here...

解决方法:

不,Python中没有内联注释.

documentation

A comment starts with a hash character (#) that is not part of a
string literal, and ends at the end of the physical line. A comment
signifies the end of the logical line unless the implicit line joining
rules are invoked. Comments are ignored by the syntax; they are not
tokens.

上一篇:“#noqa”在Python评论中意味着什么?


下一篇:是否应将Javadoc评论添加到实施中?