10
8

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 5 years have passed since last update.

UTF-8のCSVファイルをExcelでよめるよう変換

Posted at
  • しばしば発生するあれ。
  • 特殊文字が入ってて厳密にちゃんとやるなら置換の表とかいるんだろうけど、とりあえず見えれば良い位で変換したいとき
  • 何か毎回時間くうのでメモ
src = open('src.csv')
csv = src.read()
src.close()

csv_utf = unicode(csv, 'utf-8')
csv_sjis = csv_utf.encode('cp932', 'replace')

dest = open('dest.csv', 'w')
dest.write(csv_sjis)
dest.close()
10
8
1

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
10
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?