Shutil

Ejemplos de código

16
0

archivo de copia de python

from shutil import copyfile
copyfile(src, dst)
2
0

instalar shutil

pip install pytest-shutil
1
0

shutil

The shutil module offers a number of high-level operations on files and 
collections of files. In particular, functions are provided which 
support file copying and removal. For operations on individual files, 
see also the os module.
0
0

shutil copiar python

import os
import shutil

source = 'current/test/test.py'
target = '/prod/new'

assert not os.path.isabs(source)
target = os.path.join(target, os.path.dirname(source))

# create the folders if not already exists
os.makedirs(target)

# adding exception handling
try:
    shutil.copy(source, target)
except IOError as e:
    print("Unable to copy file. %s" % e)
except:
    print("Unexpected error:", sys.exc_info())

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................