热线电话:13121318867

登录
2019-06-25 阅读量: 420
如何在python中编写空函数

在Python中,要编写空函数,我们使用pass语句。pass是Python中的一个特殊语句,它什么都不做。它只能作为虚拟语句。

# Correct way of writing empty function

# in Python

def fun():

pass

我们也可以在空语句中使用pass。

# Empty loop in Python

mutex = True

while (mutex == True) :

pass

0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子