[Tutor] File copying - best way?
Andrei Kulakov
ak@silmarill.org
Sat, 04 Aug 2001 21:23:23 -0400
On Sat, Aug 04, 2001 at 09:22:05PM -0400, fleet@teachout.org wrote:
> Between
> os.popen("cp /path1/newfile /path2/oldfile")
> and
> open("/path1/newfile","w").write(open("/path2/oldfile","r").read())
>
> Which, if either, is the "preferred" method of copying a file? The second
> will raise an IOError if it fails. I have no clue how to test the first.
>
> Are there other and/or better methods of copying a file?
shutil.copy()
--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline