What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-24 18:15:04
how to move a txt file in python
import os import shutil os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo") shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo") os.replace("path/to/current... Add solution -
Python 2022-02-18 18:00:02
python copy file
from shutil import copyfile copyfile(src, dst) Add solution -
Html 2022-02-14 23:15:02
javascript hack
import os import shutil sourcePath = r'C:\Users\...\What_to_copy_to_phone' destPath = r'Computer\XT1032\Internal storage' for root, dirs, files in os.walk(sourcePath): #figure out where we're going dest = destPath + root.replace(sourcePath, '') #if we'r... Add solution -
Python 2021-11-15 16:13:18
how to delete file in python
import os import shutil if os.path.exists("demofile.txt"): os.remove("demofile.txt") # one file at a time os.rmdir("test_directory") # removes empty directory shutil.rmtree("test_directory") # removes not empty ... Add solution -
Python 2021-11-15 07:58:27
python dlete folder
import shutil shutil.rmtree('/folder_name') Add solution -
Python 2021-11-11 22:17:09
python copy paste file
#shutil module has many methods you can use from shutil import copyfile copyfile(source, destination) # Copy the contents of the file named src to a file named dst. Both src and dst need to be the entire filename of the files, including path. # The destin... Add solution -
Python 2021-11-10 03:32:17
python os remove file
import os import shutil if os.path.exists("demofile.txt"): os.remove("demofile.txt") # one file at a time os.rmdir("test_directory") # removes empty directory shutil.rmtree("test_directory") # removes not empty ... Add solution