【发布时间】:2016-06-04 15:05:45
【问题描述】:
我的代码中的部分是:
def upload_action(client):
"""
uploads the requested file by socket to server
receives: socket - client socket
returns: nothing
"""
file, filename = get_file_and_filename(client.makefile('r'))
write_to_file(file, filename)
我想制作文件并将其保存在选定的目录中,而不是当前脚本目录中。有可能吗?
例如,我想在 c:\heights\files 上制作文件。 我希望该文件由该目录中的 client.makefile('r') 创建。 如何?
【问题讨论】:
-
什么目录?我没有看到对目录的任何引用。
-
现在添加了一个示例路径
-
如果我的回答回答了你的问题,请采纳。
标签: python file sockets makefile directory