Форум сайта python.su
всем привет. из базы получаю 2 массива
mas1 =[ ['\xc0\xed\xe4\xf0\xe5\xe5\xe2\xe0 \xc5\xea\xe0\xf2\xe5\xf0\xe8\xed\xe0 \xcf\xe5\xf2\xf0\xee\xe2\xed\xe0', ['2010-11-01', 3], ['2010-11-02', 5], ['2010-11-03', 1]],
['\xc2\xe0\xf1\xe8\xeb\xfc\xe5\xe2\xe0 \xc0.\xcd.', ['2010-11-01', 6], ['2010-11-02', 6], ['2010-11-03', 6]],
['\xcc\xe0\xea\xee\xe2\xe0 \xc3.\xd0.', ['2010-11-01', 7], ['2010-11-02', 8], ['2010-11-03', 8]]]
mas2 =[ ['\xc0\xed\xe4\xf0\xe5\xe5\xe2\xe0 \xc5\xea\xe0\xf2\xe5\xf0\xe8\xed\xe0 \xcf\xe5\xf2\xf0\xee\xe2\xed\xe0', ['2010-11-01', 3], ['2010-11-02', 5], ['2010-11-03', 1]],
['\xc4\xec\xe8\xf2\xf0\xe8\xe5\xe2\xe0 \xc0.\xc8.', ['2010-11-01', 6], ['2010-11-02', 7], ['2010-11-03', 4]],
['\xc2\xe0\xf1\xe8\xeb\xfc\xe5\xe2\xe0 \xc0.\xcd.', ['2010-11-01', 6], ['2010-11-02', 6], ['2010-11-03', 6]]]
def func_1(mas3, mas4):
for j in mas4:
if mas3[0] == j[0]:
return True
return False
for i in mas1:
if func_1(i[0],mas2):
pass
else:
mas2 += [i]
if mas1[1][0] == mas2[2][0]:
print 'yes'
Офлайн
Привет, ну попробую подсказать:
1)
else:
mas2 += [i]
mas2.append(i)
Отредактировано (Ноя. 22, 2010 17:13:34)
Офлайн