Last active
February 23, 2017 01:20
-
-
Save shomah4a/8c635ed477fd8c18c2af37559302c221 to your computer and use it in GitHub Desktop.
神csvをあれするやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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