Copy files in cross-platform manner
James J. Besemer
jb at cascade-sys.com
Fri Aug 23 17:22:51 EDT 2002
You maybe want copyfile or copy or some such from shutil
Greg Fortune wrote:
> Is there any builtin python function that I've overlooked for copying
> files? rename works great if you just need to move the file, but I
> actually need to make a copy.
>
> The most obvious way to me is
>
> in_file = open(src_file, 'r')
> inp = in_file.read()
> in_file.close()
>
> out = open(dst_file, 'w')
> out.write(inp)
> out.close()
>
> but I'd rather make a call to the os module and leave all the IO in C
> code...
>
> Thanks,
>
> Greg
> --
> http://mail.python.org/mailman/listinfo/python-list
--
James J. Besemer 503-280-0838 voice
http://cascade-sys.com 503-280-0375 fax
mailto:jb at cascade-sys.com
More information about the Python-list
mailing list