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()
I don't know how to use baiduhi.Can you tell me how to solve the following problem?
I don't know how to use baiduhi.Can you tell me how to solve the following problem?
假設(shè)有個(gè)目錄下有很多個(gè)文件夾,分為兩類(lèi) A和B,A里面都是.txt文檔,B里面又有文件夾,二文件夾 下才是.txt 怎樣把A中.txt單獨(dú)壓縮在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
假設(shè)有個(gè)目錄下有很多個(gè)文件夾,分為兩類(lèi) A和B,A里面都是.txt文檔,B里面又有文件夾,二文件夾 下才是.txt 怎樣把A中.txt單獨(dú)壓縮在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
英語(yǔ)人氣:203 ℃時(shí)間:2020-03-30 00:19:38
優(yōu)質(zhì)解答
我來(lái)回答
類(lèi)似推薦
- Could you please tell me ____?A.how I can solve the problem B.how I could solve the problem
- Can you tell me how I can solve the problem quickly(改為同義句)
- 英語(yǔ)翻譯
- I don't know how to solve the problem.的同義句
- Can you tell me how to get ( )the park?Sorry,I don't know the way ( )there.為什么選A?
- 右圖中空白部分的面積比陰影部分大24平方米,求陰影部分的面積
- 不需要反映條件
- 小學(xué)英語(yǔ)每單元課可以分為哪幾類(lèi)
- 作文《生活因母愛(ài)而精彩》400-500字
- 閱讀理解《諾貝爾文學(xué)情結(jié)》答案
- 一個(gè)梯形的下底是上底的三倍,如果將上底延長(zhǎng)六厘米,就成一個(gè)平行四邊形,這個(gè)梯形的上底和下底是多少厘
- 月末企業(yè)銀行存款日記賬余額為180000元,銀行對(duì)賬單余額為170000元,經(jīng)過(guò)未達(dá)帳項(xiàng)調(diào)節(jié)后的余額為160000元,則對(duì)賬日企業(yè)可以動(dòng)用的銀行存款實(shí)有數(shù)額為多少元?
猜你喜歡
- 1同桌抄我作業(yè)
- 2把一根木料鋸成相等的7段,每段所用的時(shí)間占鋸這根木料總時(shí)間的幾分之幾?
- 3水浴加熱 當(dāng)燒杯內(nèi)的水到100℃后試管中的水為什么不沸騰?
- 4小麗捐出了零用錢(qián)的一半多20元,這是還剩下100元,小麗求原有多少元
- 5(2X減三)平方等于根二(2X減三)的解題過(guò)程
- 6若某原子的摩爾質(zhì)量是M g/mol,則一個(gè)該原子的真實(shí)質(zhì)量約是多少?
- 71、下面___是合法的字符型常量.A.ABC$ B.“ABD”C.ABC D.ABC’
- 81比2比根號(hào)5的直角三角形,其他兩個(gè)角是多少度?
- 996-3.56-6.44 (簡(jiǎn)便計(jì)算)
- 10翻譯The disease affected his mind so that he lost his memory.
- 11Cu與石墨做電極,HCl做電解質(zhì),能形成原電池嗎
- 12X1,X2是方程x^2-(2m-1)x+(m^2+2m-4)=0的兩個(gè)實(shí)數(shù)根,求x1^2+x2^2的最小值