for item in os.listdir("/root"):
if os.path.isfile(item):
print(item + "is a file")
elif os.path.isdir(item):
print(item + "is a dir")
else:
print("Unknown")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34 次 |
| 最近记录: |