如何使用 Python 检查文件夹的内容
如何使用 python 检查文件的内容,然后从同一文件夹复制文件并将其移动到新位置? 我有 Python 3.1,但我可以轻松移植到 2.6 谢谢你!
How can you check the contents of a file with python, and then copy a file from the same folder and move it to a new location?
I have Python 3.1 but i can just as easily port to 2.6
thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
例如,
如果您查看 shutil doc,在 .move() 下它会显示
我我猜你可以使用 copy2() 移动到另一个文件系统。
for example
If you look at the shutil doc, under .move() it says
I guess you can use copy2() to move to another file system.
os.listdir()
和 < a href="http://docs.python.org/library/shutil.html#shutil.move" rel="nofollow noreferrer">shutil.move()
。os.listdir()
andshutil.move()
.