Created
March 2, 2012 03:10
-
-
Save whatvn/1955267 to your computer and use it in GitHub Desktop.
ZS Parser
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
#!/usr/bin/env python | |
# hungnv | |
import csv | |
L0 = [ x[0] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L1 = [ x[1] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L2 = [ x[2] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L3 = [ x[3] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
#FL = [] | |
for i in xrange(len(L1)): | |
if ( '/' in L2[i] ) and ('/' not in L3[i]): | |
for j in range(len(L2[i].split('/'))): | |
print L0[i] + ',' + L1[i] + ','+ L2[i].split('/')[j] +','+ L3[i] | |
elif ( '/' not in L2[i] ) and ('/' in L3[i]): | |
for j in range(len(L3[i].split('/'))): | |
print L0[i] + ',' + L1[i] +','+ L2[i] +','+ L3[i].split('/')[j] | |
elif ( '/' in L2[i] ) and ('/' in L3[i]): | |
for j in range(len(L2[i].split('/'))): | |
print L0[i] + ',' + L1[i] + ','+ L2[i].split('/')[j] +','+ L3[i].split('/')[j] | |
else: print L0[i] + ',' + L1[i] +','+ L2[i] +','+ L3[i] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment