elif user == str(3):
src = input("Enter the location of the file you wish to copy: ")
print('\n')
dst = input("Next, enter the location where you wish to copy the file to: ")
if os.path.isfile(src):
while count < 1:
shutil.copyfile(src, dst)
print('Copy successful')
count = count + 1
else:
print('One of your paths is invalid')
检查路径是否存在且文件在 dst 变量中不存在的最佳方法是什么。
PS:如果这是一个愚蠢的问题,我很抱歉,但最好的学习方法是犯错误!