0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python フォルダ内の全Zipを解凍処理(再帰的)文字化け対応 (Qiita初投稿)

Posted at

初Qiita投稿
普段はRとかPythonとデータ可視化をTableauでやっています。

#ZipをPythonで解凍したいけど文字化けするしてしまうとき

#import

from zipfile import ZipFile

#文字化けしないで解凍

for file in zip_files:
    with ZipFile(file) as zip:
       for info in zip.infolist():
           info.filename = info.filename.encode('cp437').decode('cp932')
           zip.extract(info)  

人によってはunicodeとかでもできるらしい。
これで解凍できます。

##Qiita初投稿
何年も私、助けられすぎているので少しずつノウハウを更新できれば。
がんばります

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?