新手学python-笨方法学python-ex2-注释和#号

写给某人:有一位同学天天在我耳边念叨Python语言如何如何好(请恕我词穷不知如何复述那个如何如何到底是有多如何如何),所以下定决心要从头开始学习了。写代码一直是我的软肋,希望这次能坚持学习,边学边记。

跟着笨方法学python个教程学习,边学变做习题边记录。

笨方法学英语-ex2-注释和#号 - 学习记录

[root@lc test]# vi ex2.py 

# 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 od code:
# print "This won't run."

print "This will run." 
"ex2.py" 9L, 300C written
[root@lc test]# 


执行该程序,得到以下结果:

[root@lc test]# python ex2.py 
I could have code like this.
This will run.
[root@lc test]# 


弄清楚”#”符号的作用。而且记住它的名字。(中文为井号,英文为 octothorpe 或者 pound character)。

Tuesday, October 27, 2015 | Python

文章评论

No comments posted yet.

发表评论

Please add 1 and 6 and type the answer here: