Skip to content

Instantly share code, notes, and snippets.

@shomah4a
Last active February 23, 2017 01:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shomah4a/8c635ed477fd8c18c2af37559302c221 to your computer and use it in GitHub Desktop.
Save shomah4a/8c635ed477fd8c18c2af37559302c221 to your computer and use it in GitHub Desktop.
神csvをあれするやつ
import codecs
import csv
import sys
def main():
with codecs.open('syukujitsu.csv', encoding='sjis') as fp:
reader = csv.reader(fp)
contents = list(reader)[2:-2]
results = []
for i in range(3):
for line in contents:
results.append(line[i*2:i*2+2])
with codecs.open('holidays.csv', 'w', encoding='utf-8') as fp:
writer = csv.writer(fp)
writer.writerow(['名称', '日付'])
writer.writerows(results)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment