程序里的注释是很重要的。它们可以用自然语言告诉你某段代码的功能是什么。在你想要临时移除一段代码时,你还可以用注解的方式将这段代码临时禁用。接下来的练习将让你学会注释:

1 #-- coding: utf - 8 --
2 # A comment, this is so you can read your program later. 
3 
4 # Anything after the # is ignored by python. 
5 print "I could have code like this." # and the comment after is ignored 
6 # You can also use a comment to "disable" or comment out a piece of code: 
7 # print "This won't run." 
8 
9 print "This will run."
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-06-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案