美文网首页
ex02.注释和#号

ex02.注释和#号

作者: 李有锐 | 来源:发表于2019-02-07 23:58 被阅读0次

1. 环境介绍

我使用的环境是windows10/notepad++/Python 3.7.2

2. 代码

# coding:utf-8
# A comment,this is so you can read your program later.
# Anything after the # is ignored by python.

print("I could have code like this.") # and thie comment after is ignored

# You can also use a comment to "disable" or comment out a piece of code:
# print("This won't run.")

print("This will run.")

3.输出

ex02输出.png

4. 附加练习

5. 总结

  1. #号的作用就是注释,注释简单的解释就是:给人看的语句,而不是给Python解释器看的语句。
  2. 多行注释可以使用'''注释内容'''(即三个单引号或多引号一组,注释内容左右各一组)。
  3. 注释很重要,虽然我不是程序员,但好的注释可能会让一个程序显得更专业和事半功倍。只是我个人的猜测。

相关文章

网友评论

      本文标题:ex02.注释和#号

      本文链接:https://www.haomeiwen.com/subject/uphnsqtx.html