the script can not go through all the list, anyone could help, would be highly
appreciated, thanks a lot !
output:
initial 7 lines:
[9379, 'G', '0.1830']
[9378, 'G', '0.1752']
[9377, 'G', '0.1929']
[9375, 'G', '0.1950']
[9370, 'G', '0.1872']
[937, 'G', '0.1931']
[93, 'G', '0.1974']
processing:
code_K = 93 rate_K = -1 len_K = 1 len_G = 7
code_K = 93 rate_K = 0.1830 code_G = 9379 rate_G = 0.1830
code_K = 93 rate_K = 0.1929 code_G = 9377 rate_G = 0.1929
code_K = 93 rate_K = 0.1929 code_G = 9370 rate_G = 0.1872
code_K = 93 rate_K = 0.1974 code_G = 93 rate_G = 0.1974
final 3 lines:
[9378, 'G', '0.1752']
[9375, 'G', '0.1950']
[937, 'G', '0.1931']
code:
...... # read data from .csv
print "initial", len(list_G), "lines:"
for row_G in list_G:
print row_G
print "processing:"
for row_K in list_K:
code_K = str(row_K[0])
rate_K = -1
len_K = len(list_K)
len_G = len(list_G)
print "code_K =", code_K, "rate_K =", rate_K, "len_K =", len_K, "len_G =",
len_G
for row_G in list_G:
code_G = str(row_G[0])
rate_G = str(row_G[2])
if re.match(code_K, code_G):
if rate_K < rate_G:
rate_K = rate_G
print "code_K =", code_K, "rate_K =", rate_K, "code_G =", code_G, "rate_G
=", rate_G
list_G.remove(row_G)
print "final", len(list_G), "lines:"
for row_G in list_G:
print row_G
--
http://mail.python.org/mailman/listinfo/python-list