Comment déplacer et supprimer des fichiers dans Python

import os

os.rename('./blogs/1.txt', './blogs/Test Directory 1/1.txt')
os.rename('./blogs/2.txt', './blogs/Test Directory 2/1.txt')

# So, in the first rename method, we are taking 1.txt from the blogs directory and moving it to Test Directory 1 which is a subdirectory of blogs.
# In the second scenario, we are taking 2.txt and moving it to the Test Directory 1 directory with the name 1.txt.
# Yes, we just moved and renamed the file at the same time.

# By using the remove() method we can remove the file.
# For example, if we want to remove the 3.txt file from the blogs directory.
# To do this, we can write the following code:

import os

os.remove('./blogs/3.txt')
OHIOLee