Jython 2.2.1,如何移动文件? Shutils.move 不存在!

发布于 2024-07-08 19:27:34 字数 142 浏览 7 评论 0原文

'''use Jython'''

import shutil

print dir(shutil)

没有,shutil.move,如何用 Jython 移动文件? 当我们这样做时,如何使用 Jython 删除文件?

'''use Jython'''

import shutil

print dir(shutil)

There is no, shutil.move, how does one move a file with Jython?
and while we at it, how does one delete a file with Jython?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

山人契 2024-07-15 19:27:34

os.rename() 用于移动,os.unlink() 用于删除 - 就像 Python pre-shutil 一样。

os.rename() to move, and os.unlink() to delete -- just like Python pre-shutil.

锦欢 2024-07-15 19:27:34

如果您需要跨文件系统移动的支持,请考虑将 CPython 的 shutil.py 复制到您的项目中。 Python 许可证 足够灵活,足以允许这样做(即使是商业用途)项目),只要保留许可和归属信息。

If you need support for moving across filesystems, consider just copying CPython's shutil.py into your project. The Python License is flexible enough to allow this (even for commercial projects), as long as licensing and attribution information are retained.

东走西顾 2024-07-15 19:27:34
f1 = File(filename_old)
f1.nameTo(File(filename_new))
f1 = File(filename_old)
f1.nameTo(File(filename_new))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文