如何在 Windows 上隐藏文件? [英] How can I make a file hidden on Windows?
本文介绍了如何在 Windows 上隐藏文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Windows 上,您可以右键单击文件,单击属性并选择隐藏.如何对 python 中的文件执行此操作?
On windows you can right-click a file, click on properties and select hidden. How can I do this to a file in python?
推荐答案
如果您不想/无法访问 win32 模块,您仍然可以调用 attrib
:
If you don't want/don't have access to win32 modules you can still call attrib
:
import subprocess
subprocess.check_call(["attrib","+H","myfile.txt"])
这篇关于如何在 Windows 上隐藏文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文