python 中注释有两种

第一种,文档注释

第二种,一般的注释

下面是例子:

class MyClass:
  '这个是文档注释'
  def __repr__(self):
    return "repr";
  def __str__(self):
    return "str";

------------------------------------------

#‘#’是一般的注释
# 测试print 时调用的函数!

a = MyClass();
print "print a :",;
print a;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2018-01-08
  • 2022-12-23
  • 2018-01-09
猜你喜欢
  • 2021-09-03
  • 2022-02-25
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案