WW S-JIS Encode v1

a guest Apr 28th, 2015 8 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import codecs
  2. import os
  4. # Find path of current file
  5. mypath = os.path.dirname(os.path.realpath(__file__))
  6. # Find list of all TSV files in this folder
  7. files = [f for f in os.listdir(mypath) if os.path.isfile(f) and
  8.          os.path.splitext(f)[1] == '.tsv']
  9. for filename in files:
  10. # Read UTF-encoded data
  11.     with,'rb','utf_8') as f:
  12.         filename = os.path.splitext(filename)[0] + '.csv'
  13. # Write SHIFT-JIS encoded data
  14.         with,'wb','cp932') as g:
  15.             for line in f:
  16.                 g.write(line)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand