Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A00
- A10
- A21
- ”09321609”,”15274”, etc.
- 00I
- 0109321609
- 0215274
- 032
- 0419685
- 05
- 062
- 072
- 081
- 09
- 111
- 121
- 15
- 161
- 17
- 1814740
- 1920120401
- 2020120401
- 2120120401
- 22
- 230
- 240
- 251
- 26BLAHBLAH 1000MG
- 27
- 281
- 29
- 30
- 31BLAHBLAH 1000 mg Filmtablets Hursutacinzki
- 32
- 3336
- 341
- 350
- 361
- 371
- 401
- 410
- 420
- 43
- 445774
- 45FTA
- 46
- 47AN03AX14
- 48BLAHBLAH00000000000000000000010
- 491
- 501
- 512
- 522
- 5317
- 542
- 552
- 561
- 572
- 581
- 591
- 60
- 61
- 62
- 631
- 641
- 65
- 66
- 67
- 681
- 69
- 721
- 74884
- 761
- 771
- 780
- 790
- 801
- 811
- 831
- 851474
- 86
- 871
- 880
- 891
- 901
- 911
- 922
- 930
- 941
- 951
- 961
- 97
- 98
- 990
- A00
- A10
- A21
- from itertools import izip
- import csv
- with open('data.txt') as inf, open('data.csv','wb') as outf:
- lines = (line[2:].rstrip() for line in inf)
- rows = (data[1:89] for data in izip(*([lines]*92)))
- csv.writer(outf).writerows(rows)
- import csv
- fo = csv.writer(open('out.csv','wb'))
- with open('eg.txt', 'r') as f:
- for line in f:
- assert line[:3] == '00I'
- buf = []
- for i in range(88):
- line = f.next()
- buf.append(line.strip()[2:])
- line = f.next()
- assert line[:3] == 'A00'
- line = f.next()
- assert line[:3] == 'A10'
- line = f.next()
- assert line[:3] == 'A21'
- fo.writerow(buf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement