Skip to content

Instantly share code, notes, and snippets.

@yukkeorg

yukkeorg/in.txt Secret

Last active April 28, 2016 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukkeorg/bb8c7ad230e1f17ca9413a90ffa77b14 to your computer and use it in GitHub Desktop.
Save yukkeorg/bb8c7ad230e1f17ca9413a90ffa77b14 to your computer and use it in GitHub Desktop.
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