博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python的pass语句_Python | 演示pass语句的示例
阅读量:2529 次
发布时间:2019-05-11

本文共 775 字,大约阅读时间需要 2 分钟。

python的pass语句

python中的pass语句 (pass statement in python)

"pass" is a type of null operation or null statement, when it executes nothing happens. It is used when you want do not want to write any code/statement to execute but syntactically a statement is required.

“ pass”是空操作或空语句的一种,执行时不执行任何操作。 当您不想编写任何代码/语句来执行但在语法上需要一条语句时,可以使用它。

Let’s consider the given example...

让我们考虑给定的例子...

Here, we are using "pass" statement in the function hello() definition - there is no statement in the function and if we do not use "pass", there will be an error.

在这里,我们在函数hello()定义中使用“ pass”语句-函数中没有语句,如果我们不使用“ pass” ,则会出现错误。

def hello():    passhello()

Example 2:

范例2:

for i in range(1,11):    if(i==6):        continue    else:        pass    print(i)

Output

输出量

1234578910

翻译自:

python的pass语句

转载地址:http://cttzd.baihongyu.com/

你可能感兴趣的文章
【MyBean调试笔记】接口的使用和清理
查看>>
07 js自定义函数
查看>>
jQueru中数据交换格式XML和JSON对比
查看>>
form表单序列化后的数据转json对象
查看>>
[PYTHON]一个简单的单元測试框架
查看>>
iOS开发网络篇—XML数据的解析
查看>>
[BZOJ4303]数列
查看>>
一般处理程序在VS2012中打开问题
查看>>
C语言中的++和--
查看>>
thinkphp3.2.3入口文件详解
查看>>
POJ 1141 Brackets Sequence
查看>>
Ubuntu 18.04 root 使用ssh密钥远程登陆
查看>>
Servlet和JSP的异同。
查看>>
虚拟机centOs Linux与Windows之间的文件传输
查看>>
ethereum(以太坊)(二)--合约中属性和行为的访问权限
查看>>
IOS内存管理
查看>>
我需要一个足够大的桌子
查看>>
middle
查看>>
[Bzoj1009][HNOI2008]GT考试(动态规划)
查看>>
Blob(二进制)、byte[]、long、date之间的类型转换
查看>>