python - 如何在 Python 中编写内联注释

标签 python comments

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.

关于python - 如何在 Python 中编写内联注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24872745/

相关文章:

python - py2exe 找不到所有依赖项

python - 来自 matplotlib 的 pickle 数字

python - Python : Making a Magic 8 Ball game, why do i keep getting syntax errors? Here's the code, test it if you want

eclipse - GhostDoc 等效于 Eclipse(Java)

python - Django 验证错误消息仅显示在管理页面中

python - 从类内部分配类变量动态值

c# - 是否可以为 Func<T1,T2,....> 参数的部分提供智能感知的 xml 注释?

ruby - Ruby 中的内联注释

c - NetBeans 中 C 文件的 ToggleComment 设置

comments - 更改 Python 代码中文档字符串的位置