python中怎样将文件拷贝到指定的目录下?
2个回答
2016-05-16
展开全部
用readline
inputFile = open("inputFile.txt", "r")
print "Name of the input file: ", inputFile.name;
outputFile = open("outputFile.txt", "a");
print "Name of the output file: ", outputFile.name;
allLines = inputFile.readlines();
for eachLine in allLines:
print "current line content: %s" % (eachLine);
#append into output file
outputFile.write(eachLine);
inputFile.close();
outputFile.close();
inputFile = open("inputFile.txt", "r")
print "Name of the input file: ", inputFile.name;
outputFile = open("outputFile.txt", "a");
print "Name of the output file: ", outputFile.name;
allLines = inputFile.readlines();
for eachLine in allLines:
print "current line content: %s" % (eachLine);
#append into output file
outputFile.write(eachLine);
inputFile.close();
outputFile.close();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询