Skip to content

Instantly share code, notes, and snippets.

@yukkeorg

yukkeorg/in.txt Secret

Last active Apr 28, 2016
Embed
What would you like to do?
aaaaaaaa bbbbb cccccc dddddddd eeeeee 10/01 10/02 10/03 10/04 10/05 10/06 10/07 10/08 10/09 10/10 10/11 10/12 10/13 10/14 10/15 10/16 10/17 10/18 10/19 10/20 10/21 10/22 10/23 10/24 10/25 10/26 10/27 10/28 10/29 10/30 10/31 11/01 11/02 11/03 11/04 11/05 11/06 11/07 11/08 11/09 11/10 11/11 11/12 11/13 11/14 11/15 11/16 11/17 11/18 11/19 11/20 11/21 11/22 11/23 11/24 11/25 11/26 11/27 11/28 11/29 11/30
00000000 1111111 22222222 ああああああああああああああああああああああああああああああああああああああああああああああ 3 1 × × × × × 1 1 1 1 × × × × 1 1 1 × × × 1 × × × × 1 1 1 1 1 1 × × 1 1 1 1 × 1 1 1 1 1 1 1 × × 1 1 × 1 1 1 × × × 1 1 1 × 1
aaaaaaaa,bbbbb,cccccc,dddddddd,eeeeee,10/01,10/02,10/03,10/04,10/05,10/06,10/07,10/08,10/09,10/10,10/11,10/12,10/13,10/14,10/15,10/16,10/17,10/18,10/19,10/20,10/21,10/22,10/23,10/24,10/25,10/26,10/27,10/28,10/29,10/30,10/31,11/01,11/02,11/03,11/04,11/05,11/06,11/07,11/08,11/09,11/10,11/11,11/12,11/13,11/14,11/15,11/16,11/17,11/18,11/19,11/20,11/21,11/22,11/23,11/24,11/25,11/26,11/27,11/28,11/29,11/30
00000000,1111111,22222222,ああああああああああああああああああああああああああああああああああああああああああああああ,3,1,×,×,×,×,×,1,1,1,1,×,×,×,×,1,1,1,×,×,×,1,×,×,×,×,1,1,1,1,1,1,×,×,1,1,1,1,×,1,1,1,1,1,1,1,×,×,1,1,×,1,1,1,×,×,×,1,1,1,×,1
# -*- coding: utf-8 -*-
import codecs
import sys
import csv
import re
if __name__ == "__main__":
fp = open('out.csv.txt', 'aw')
f = codecs.open("in.txt","r",encoding='utf-8')
rows1=[]
for row in f:
row = row.strip()
rows = re.split('\t',row)
rows1.append(rows)
print rows1
w = csv.writer(fp,delimiter=',')
for r in rows1:
r = [s.encode('utf-8') for s in r]
w.writerow(r)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment