在下面的python代码中,我尝试编写代码以通过创建新目录将使用Lists的不同格式的特定文件从一个文件夹复制到另一个文件夹
谢谢
import pandas as pd
import os
import shutil
print("Welcome to error_Validator")
x=input("Please Enter the File Address to Process:")
y=input("Please Enter the Sheet Name to Process:")
print("Please wait,Your File is Processing")
data = pd.read_excel(x,Sheet_name=y)
data=pd.DataFrame(data)
column_names=list(data.columns)
print("Enter Column_names to validate Errors :")
print(column_names)
n=int(input("Please Enter the Column Numbers to Process :"))
i=1
colList = []
while i<=n :
nameofcolumns=input("Please Enter the Column Names to Process :")
colList.append(nameofcolumns)
i+=1
print(colList)
col_names=[]
colnames=[]
for items in colList :
null_status=data[items].notnull()
c=data[null_status]['ResumeFileName'].values.tolist()
col_names.append(c)
colnames.append(items)
dir_src =("/home/mgbhargava/Documents/totalresumes")
dir_dst=os.chdir(os.mkdir(items))
dirList = os.listdir(dir_src)
for f in col_names:
for e in dirList :
if e==f :
#dest=os.chdir(os.mkdir(items))
print("Directory changed")
shutil.copy(f,dir_dst)
print("Congratulations,Your Folders are Processed Successfully")
print("Congratulations,Your Files are Processed Successfully")