Guest User

WW S-JIS Encode v1

a guest
Apr 28th, 2015
54
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import codecs
  2. import os
  3.  
  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 codecs.open(filename,'rb','utf_8') as f:
  12.         filename = os.path.splitext(filename)[0] + '.csv'
  13. # Write SHIFT-JIS encoded data
  14.         with codecs.open(filename,'wb','cp932') as g:
  15.             for line in f:
  16.                 g.write(line)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×