'zip'에 해당되는 글 1건
- 2009.10.12 [python] zipfile 관련내용
D:\tmp>dir
D 드라이브의 볼륨: 새 볼륨
볼륨 일련 번호: 0C2D-54F0
D:\tmp 디렉터리
2009-10-12 오후 10:55 <DIR> .
2009-10-12 오후 10:55 <DIR> ..
2009-09-29 오후 11:16 5,544 a.txt
2009-09-29 오후 11:16 5,544 b.txt
2009-09-29 오후 11:16 5,544 c.txt
2009-09-29 오후 11:16 5,544 list.txt
6개 파일 56,000 바이트
6개 디렉터리 32,899,330,048 바이트 남음
D:\tmp>
>>> import zipfile
>>> f.close()
>>> f=zipfile.ZipFile('d:\\tmp\\test.zip','w')
>>> f
<zipfile.ZipFile object at 0x04E3DA50>
>>> f.namelist()
[]
>>> import os
>>> os.getcwd()
'C:\\Windows\\system32'
>>> os.chdir('d:\\tmp')
>>> os.getcwd()
'd:\\tmp'
>>> L=['a.txt','b.txt','c.txt']
>>> L
['a.txt', 'b.txt', 'c.txt']
>>> flist=['a.txt','b.txt','c.txt']
>>> for fname in flist:
... f.write(fname)
...
>>> f.close()
>>> os.getcwd()
'd:\\tmp'
>>> f.close
<bound method ZipFile.close of <zipfile.ZipFile object at 0x04E3DA50>>
>>> f.close()
>>>
>>>
>>> import zipfile
>>> f=zipfile.ZipFile('park.zip','w')
>>> L=['a.txt','b.txt','c.txt']
>>> flist=['a.txt','b.txt','c.txt']
>>> for fname in flist:
... f.write(fname)
...
>>> f.close()
>>> g=zipfile.ZipFile('park.zip')
>>> g.namelist()
['a.txt', 'b.txt', 'c.txt']
>>>
D:\tmp>dir
D 드라이브의 볼륨: 새 볼륨
볼륨 일련 번호: 0C2D-54F0
D:\tmp 디렉터리
2009-10-12 오후 10:55 <DIR> .
2009-10-12 오후 10:55 <DIR> ..
2009-09-29 오후 11:16 5,544 a.txt
2009-09-29 오후 11:16 5,544 b.txt
2009-09-29 오후 11:16 5,544 c.txt
2009-09-29 오후 11:16 5,544 list.txt
2009-10-12 오후 10:54 16,912 park.zip
2009-10-12 오후 10:17 16,912 test.zip
6개 파일 56,000 바이트
6개 파일 56,000 바이트
6개 디렉터리 32,899,330,048 바이트 남음
D:\tmp>
Recent Comment