1. On the python file operation function shutil.move [src.dst] question, src must specify the path.
2. I want to know why f..python in shutil.move can identify the path of f? I don"t think there is any logic here. Because the f here does not assemble any paths. It"s just an f variable in for loop..
3. The file in the following code was copied successfully, but on the surface, f did not get any path, how to determine the f path? no, no, no.
Code hint:
`
import shutil
import os
path =". /"- there are several files or folders under the current path of sharp.
files = os.listdir (path)
for f in files:
folder_name = os.path.join("./",f.split(".")[-1])
if not os.path.exists(folder_name):
os.makedirs(folder_name)
shutil.move(f,folder_name)
else:
shutil.move(f,folder_name)
`