> For the complete documentation index, see [llms.txt](https://minghuiwu.gitbook.io/tfbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minghuiwu.gitbook.io/tfbook/fu-lu-2-gong-yu-shan-qi-shi-bi-xian-li-qi-qi-jian-ming-python-ji-chu/fu-lu-1-gong-yu-shan-qi-shi-bi-xian-li-qi-qi-jian-ming-python-ji-chu/2.22-pass-yu-ju.md).

# 2.22 pass语句

pass语句是空语句，它是为了保持程序结构的完整性，一般用做占位语句。

我们还是用刚刚这个例子：

![图2-122](blob:https://minghuiwu.gitbook.io/741885b2-e44f-4609-b3b2-caa83e624203)

在这个程序中，我们可以用pass来代替continue，然后在下面多加上一个else语句。在刚刚的程序中，“without9 += digit”这条语句和if语句是平行结构，而在现在这个程序中是if else语句，也就是两者选其一的结构：当这个数字为9就不加上，如果不是9就加上去。两个程序实现了一样的结果。

## > 示例代码

{% code title="1.py" %}

```python
# 求在2的100次方中删除所有的9后的数字:

num = 2**100
without9 = ''
for digit in str(num):
    if digit == "9":
        pass
    else:
        without9 += digit
print("2**100 is: %d \nwithout 9 is :%s" %(num,without9))
```

{% endcode %}
