《笨办法学Python》 第2课手记
2016-01-02 23:03
627 查看
《笨办法学Python》 第2课手记
这节课的内容很简单,目的是要探求#号的作用,目前我们已知的内容是,作为注释的标识符。在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都是注释,编译时都被忽略。
本节涉及的内容:
“#”在python中的作用:#!/usr/bin/python
这段代码中#用来定义python解释器(编译器?)的位置。
目前只在知乎找到这么一个除了注释之外的作用,稍后再补吧。
相关文章推荐
- Python的队列
- Python 2.5.1 切片
- python之Merge Intervals
- Python标准库14 数据库 (sqlite3)
- python 代码片段4
- 2016/1/2 Python中的多线程(1):线程初探
- python socket多线程
- Python安装指南
- python coding style guide 的快速落地实践
- python 代码片段2
- python 代码片段
- python实现onvif协议-2
- 欢迎使用CSDN-markdown编辑器
- Python比较for循环、列表解析、迭代器、map之间运算时间关系
- Python的栈
- 为Eclipse安装Python开发插件
- leetcode之Spiral Matrix II
- python基础-面向对象
- Pyhton 2.5 高级特性
- Python3 字典使用上的一个小细节