---
title: 磁盘信息
description: "磁盘信息可以通过shell命令df -h查询。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenggrf/codeprtr/kunpengtaishanporting_12_0077.html
sourcePath: /source/zh/kunpenggrf/codeprtr/kunpengtaishanporting_12_0077.html
indexId: 8c02a2e04dcc1fcf1dadd841f2473d6aeee19f3dd0a44978ec5de31b3c86590a65
---
# 磁盘信息

磁盘信息可以通过shell命令df -h查询。

代码示例：

```
def get_disc_info():
#disc_info = os.popen("df -h").read()
#disc_info = subprocess.Popen("df -h", shell=True).communicate()[0]
#print(disc_info)
pipe = subprocess.Popen("df -h", stdout=subprocess.PIPE, shell=True)
disc_info = pipe.stdout.read()
print(disc_info)
```
