开发者

How do I use Python to prevent a file from being copied?

I have a file that I need to "protect" so that it cannot be copied! I am using Python on Windows XP.

I think it may j开发者_Go百科ust be changing file permissions??


You can prevent the file being copied only by removing read permission from the user that shouldn't be able to copy the file. You can use os.chmod for this, or see this page explaining to set permissions with the full Windows security model.


Is this a temporary or a permanent file? If it's temporary, take a look at the tempfile module, especially tempfile.mkstemp().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜