Am 02.04.2012 23:11 schrieb HoneyMonster:

One way:
import os

os.system ("cp src sink")

Yes. The worst way you could imagine.

Why not the much much better

from subprocess
subprocess.call(['cp', 'src', 'sink'])

?

Then you can call it with (really) arbitrary file names:


def call_cp(from, to):
    from subprocess
    subprocess.call(['cp', '--', from, to])

Try that with os.system() and from="That's my file"...


Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to