I don't know how to use baiduhi.Can you tell me how to solve
来源:学生作业帮 编辑:拍题作业网作业帮 分类:英语作业 时间:2024/04/28 23:26:49
I don't know how to use baiduhi.Can you tell me how to solve the following problem?
假设有个目录下有很多个文件夹,分为两类 A和B,A里面都是.txt文档,B里面又有文件夹,二文件夹 下才是.txt 怎样把A中.txt单独压缩在A文件夹里,B中以则子文件夹为单位压缩在B中
Assuming that a directory has many folders.There are two types of these folders,A and B.
In the A ,all the documents are .txt documents.But B has lots of folders like A.
How to put .TXT compression alone in A
and put subfolders compression in the B
假设有个目录下有很多个文件夹,分为两类 A和B,A里面都是.txt文档,B里面又有文件夹,二文件夹 下才是.txt 怎样把A中.txt单独压缩在A文件夹里,B中以则子文件夹为单位压缩在B中
Assuming that a directory has many folders.There are two types of these folders,A and B.
In the A ,all the documents are .txt documents.But B has lots of folders like A.
How to put .TXT compression alone in A
and put subfolders compression in the B
Gotha,wait a moment,I'm writing it.
This code is written according to the cases you just described
the APath and BPath should be the path of A and B folder.
#
import tarfile
import os
APath = 'A'
dirA = os.walk(APath).next()[2]
tarA = tarfile.open('A/txt.tar.bz','w:bz2')
for file in dirA:
tarA.add(os.path.join(APath,file))
tarA.close()
BPath = 'B'
dirB = os.walk(BPath).next()[1]
os.chdir('B')
for directory in dirB:
tar = tarfile.open(directory+'tar.bz','w:bz2')
tar.add(directory)
tar.close()
This code is written according to the cases you just described
the APath and BPath should be the path of A and B folder.
#
import tarfile
import os
APath = 'A'
dirA = os.walk(APath).next()[2]
tarA = tarfile.open('A/txt.tar.bz','w:bz2')
for file in dirA:
tarA.add(os.path.join(APath,file))
tarA.close()
BPath = 'B'
dirB = os.walk(BPath).next()[1]
os.chdir('B')
for directory in dirB:
tar = tarfile.open(directory+'tar.bz','w:bz2')
tar.add(directory)
tar.close()
I don't know how to use baiduhi.Can you tell me how to solve
Can you tell me how to get ( )the park?Sorry,I don't know th
I don't know how to solve the problem.Can you _______a good
I don't know how to solve the problem .Can you ____a good id
I still don't know how to solve this maths problem.Can you g
4道英语填空题,1.To tell you the ____,I don't know how to solve the
i don't know how to tell you .i am afraid of you and me chan
Could you tell me next? I really don't know. A HOW to do B w
Unless you will listen to me ,I won't tell you how to solve
1,I don’t know how to use the telephone.2,How do you use the
i don't know how to solve this problem.
I don't know how to play this game.Can you t___ me?