#第二章:注释和"#"
在你的程序中注释是相当重要的。他们被用来使用自然语言告诉你程序做了哪些事情,他们也被用来禁用你程序中的你不想永久删除某一部分。下面就是如何在python中使用注释。
# 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 the 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.
从现在开始我不会再写像这样的代码了,对你来说理解并不是所有的代码都需要逐字逐句加注释是很重要的。你的屏幕和程序可能看起来不一样,但是只有你输入到文件中的文字才是重要的。事实上,我可以使用任何编辑器,然后得到一模一样的结果。
###你应该看到的样子
$ python ex2.py I could have code like this. This will run
再说一次,我不会展示所有的在terminal中的截屏,你应该理解上面并不是你看到的屏幕输出的翻译,在$ python和最后一行中的文字是你需要注意的东西.
###进阶练习