Python有同步吗? [英] Does Python have sync?

查看:69
本文介绍了Python有同步吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同步手册页 说:

sync()导致对文件元数据和数据的所有缓冲修改被保存到写入底层文件系统.

sync() causes all buffered modifications to file metadata and data to be written to the underlying file systems.

Python可以打电话吗?

Does Python have a call to do this?

P.S.不是 fsync ,我明白了.

P.S. Not fsync, I see that.

推荐答案

Python 3.3具有os.sync,请参见文档.确认这是同样的事情.

Python 3.3 has os.sync, see the docs. The source confirms it is the same thing.

对于Python 2,您可以对系统进行外部调用:

For Python 2 you can to make an external call to the system:

from subprocess import check_call
check_call(['sync'])

这篇关于Python有同步吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆