python 单行注释/多行注释/代码间注释/特殊注释/"""doc String
来源:互联网 发布:趣店入职配mac 编辑:程序博客网 时间:2024/06/11 20:36
1.单行注释
python中单行注释采用 #开头
2.多行注释3.代码间注释4.特殊注释"""三个引号是注释号格式,这些注释保存在方法的__doc__属性中,可以打印显示。
python中单行注释采用 #开头
点击(此处)折叠或打开
- #!/usr/bin/python
- #filename: searchengine.py
- #input: onne
- #output: none
- #writer: mail:15933533880@163.com
- class crawler:
- """
- This is a crawler class.
- It contains the statement of some function
- """
- #initial crawler class
- def __init__(self, dbname):
- pass
-
- def __del__(self):
- pass
- def dbcommit(self):
- pass
然后python蛋疼的没有块注释,所以现在推荐的多行注释也是采用的 #
点击(此处)折叠或打开
- #!/usr/bin/python
- #filename: searchengine.py
- #input: onne
- #output: none
- #writer: mail:15933533880@163.com
点击(此处)折叠或打开
- class crawler:
- #initial crawler class
- def __init__(self, dbname):
- pass
比如#! /usr/bin/python 这句注释的意思就是告诉LINUX/UNIX去找到python的翻译器,大部分文件都不需要这个,只在要求也执行的文件中添加。
关于蛋疼的中文编码: # coding = utf-8 【注:这句代码蛋疼的必须放在第二行啊,而且多个空格都不行啊!】
5.python的福利!!
python在注释中有一个非常有用的东西是 doc String ,它可以用于模块、函数和类的描述:(其实总结起来都是类)下面是一个标准的方法注释
点击(此处)折叠或打开
- class crawler:
- """
- This is a crawler class.
- It contains the statement of some function
- """
- #initial crawler class
- def __init__(self, dbname):
- pass
-
- def __del__(self):
- pass
- def dbcommit(self):
- pass
0 0
- python 单行注释/多行注释/代码间注释/特殊注释/"""doc String
- python 单行注释 多行注释 批量注释 中文注释
- 单行注释和多行注释
- Perl中的程序注释:单行注释和多行注释
- Perl脚本注释:单行注释和多行注释
- Perl中的程序注释:单行注释和多行注释
- Perl中的程序注释:单行注释和多行注释
- Perl中的程序注释:单行注释和多行注释
- 单行注释和多行注释 文本注释
- python单行、多行及中文注释
- 代码中的特殊注释
- Lisp 的单行注释和多行注释
- shell 中的单行注释和多行注释
- Perl中的单行注释和多行注释
- shell 中的单行注释和多行注释
- JAVA_SE系列:05.单行注释和多行注释
- shell 中的单行注释和多行注释
- (转)SQLServer基础 单行注释与多行注释
- manage .deb package in linux (ubuntu) dpkg
- some package command in linux (ubuntu) zip/ tar/ tar.gz/ tar.bz2
- Python 字典(Dictionary) setdefault()方法
- the shutdown command in linux for shutdown in time or reboot
- python 列表/元组/字典
- python 单行注释/多行注释/代码间注释/特殊注释/"""doc String
- 深入理解python之self
- install pysqlite in ubuntu
- ubuntu mentohust solutions summary
- error: sqlite3.h: No such file or directory #include "sqlite3.h"
- python中的接口
- set() in python
- 深入理解Python的字符编码utf-8 & unicode
- 字符编解码的故事(ASCII,ANSI,Unicode,Utf-8区别)