Skip to content

Instantly share code, notes, and snippets.

@parkjinwoo
Forked from midnightradio/inflate.py
Last active August 29, 2015 14:08
Show Gist options
  • Save parkjinwoo/9b94b6cc441943caaa43 to your computer and use it in GitHub Desktop.
Save parkjinwoo/9b94b6cc441943caaa43 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals, print_function
import sys, zipfile, shutil, os, fileinput
def inflate(filename):
print(filename)
zfile = zipfile.ZipFile(filename)
for f in zfile.namelist():
encfname = unicode(f,'cp949')
print(encfname)
try:
with open(encfname, 'wb') as outfile:
shutil.copyfileobj(zfile.open(f), outfile)
except IOError:
directory = os.path.dirname(encfname)
if not os.path.exists(directory):
os.makedirs(directory)
if __name__ == '__main__':
inflate(sys.argv[1])
@parkjinwoo
Copy link
Author

oh, thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment