blog/test/path.py
2019-08-17 16:48:52 +02:00

16 lines
304 B
Python

import os
import tempfile
import shutil
def temppath(*paths):
return os.path.join(tempfile.gettempdir(), *paths)
def move(src, dst):
if os.path.isfile(dst):
os.remove(dst)
elif os.path.isdir(dst):
shutil.rmtree(dst)
if os.path.exists(src):
os.rename(src, dst)