A = ['1.01', '2.01', '3.01', '5.02']
B = [['1.01', 'string'], ['3.01', 'string'], ['7.01', 'string'], ['10.01', 'string']]
print(set(A).intersection(e[0] for e in B))
from operator import itemgetter
print(set(A).intersection(map(itemgetter(0), B)))
var a = 12;
db.talks.aggregate([
{$project:{"_id":1,"from":1, "to":1, "msg":1, "ft":["$from", "$to"]}},
{$match:{"ft":a}},
{$unwind: "$ft"},
{$match:{"ft":{$ne:a}}},
{$sort:{"_id":1}},
{$group: {"_id":"$ft", "orig_id":{$last:"$_id"},"from":{$last:"$from"},
"to":{$last:"$to"},"msg":{$last:"$msg"}}},
{$sort:{"_id":1}},
{$project:{"_id":"$orig_id","from":1, "to":1, "msg":1}}
]);
<svg xmlns="http://www.w3.org/2000/svg" version="1" width="723"
height="765" viewBox="0 0 7230 7650"><g fill="#030303"><path d="M1397
7470l-87-86 98-67c450-304 734-723 833-1230 26-134 39-294
46-544l6-273h238l-1 263c-2 249 0 268 25 382 156 703 443 1163 865
1387l66 35-47 51c-26 28-64 78-85 110l-39
59-76-46c-42-25-101-65-131-88-274-207-500-557-643-990-14-46-28-83-30-83-1
0-17 44-35 98-40 124-152 352-225 462-152 226-347 421-589 588-49 34-92
61-95 60s-45-41-94-88zM3867
7478c-14-24-43-76-66-116-24-40-41-77-39-82s55-51 119-102 171-142
238-202l121-109v-937h-440v-250h680v1162l46 59c135 176 369 291 681 335
210 30 1581 28 1827-3 48-6 48-6 36 17-17 32-70 191-70 210 0 15-25
18-217 23-341 11-1336
8-1479-3-376-31-638-134-838-332-49-48-92-88-95-88-4 0-56 50-116 111-61
61-167 164-237 230l-127 120zM269 7285c-8-14-45-56-82-93l-66-68
105-84c162-129 311-295 451-505 69-102 173-281 173-295
0-34-487-751-606-893-13-16-24-32-24-37 0-4 26-27 58-51 31-23 71-53
89-66l31-24 95 123c112 146 269 363 391 541 49 71 92 125 96 120 14-13
85-199 128-333 54-166 105-364 137-530 14-74 27-143 29-152
4-17-27-18-535-18H200v-240l598-2 597-3 73 23c85 28 83 18 52 212-72
448-188 860-344 1219l-36 83 94 157c108 180 249 446 244 461-1 5-48
46-102 90l-99 81-107-208c-107-209-160-303-171-303-3 0-11 12-18 27-24
53-183 284-263 385-102 126-239 266-341 346-43 34-81 62-85
62s-14-11-23-25z"/><path d="M5850 5820V4540h1071l-3 973c-3 967-3 972-24
1018-44 95-113 119-359 126l-180 5-31-94c-17-51-34-101-38-110-7-16 7-17
179-17 128 1 191-3 199-11s11-229
11-838v-827l-292-3-293-2v2340h-240zM4715 6699c-8-23-64-224-62-225 1 0
54-14 117-30l115-29 3-932c1-513 6-933 10-933 5 0 31 7 58 15s60 15 74
15c43-1 419-203 562-303 16-10 30 0 114 84l96 96-74 39c-124 65-347
169-475 220l-123 49v793c0 435 1 792 3 792 1 0 128-35 282-79l280-78 12
76c6 42 14 92 17 111l6 36-488 143c-268 79-495 146-504 149-10
2-20-2-23-9zM1757 5752c-4-5-48-38-99-72-51-35-95-65-97-66-2-2 17-36
42-76 134-214 240-515 317-898 21-107 44-232 51-277 10-75 13-83 33-83 34
1 215 26 220 31s-47 311-69 405c-8 36-15 72-15 80 0 12 75 14 556 14
545-1 558-1 630 21 41 12 74 27 74 32 0 6-21 90-46 186-49 188-95 338-152
492l-35 97-100-34c-55-19-102-35-104-38-2-2 6-28 17-57 24-60 130-424
130-445 0-12-88-14-520-14h-519l-22 73c-11 39-39 122-61 182-70 190-216
473-231 447zM4311 5034c-60-101-191-257-341-406l-148-146 97-65 97-65 65
55c98 83 242 228 324 325 93 109 160 208 149 217-10 9-205 141-208 141-1
0-16-25-35-56zM2595 3258c-15-46-36-100-46-120l-19-38h213c195 0 215-2
230-18 16-17 17-101
17-1000v-982h-650V860h650V90h240v770h230v240h-229l-3 1017c-3 955-4
1020-21 1058-45 100-129 139-317 150-52 3-134 8-181 10l-87 6zM6226
3328c-3-7-12-38-22-68-9-30-27-79-40-107l-23-53h210c196 0 210-1 229-20
20-20 20-33 20-1000v-980h-650V860h650V90h240v770h220v240h-219l-3
1018c-3 965-4 1019-22 1059-39 91-139 138-314 148-53 3-136 8-185 11-66
3-88 2-91-8zM1641 3284c-7-26-25-75-41-110l-29-64h190c112 0 198-4 210-10
18-10 19-26 19-427v-416l-88 134c-49 74-126 181-172 239-110 138-358
386-488 489l-103 81-41-52c-22-29-57-70-76-90-20-21-34-39-31-41 2-2
27-19 54-37 164-110 390-320 526-490 71-88 181-245
208-297l12-23h-741v-220h200V470h329l17-57c9-32 33-123 53-203l36-145 118
21c65 12 120 24 123 27 6 6-59 187-102 286-13 29-24 57-24 62s92 9 205
9h205v1331c0 1014-3 1341-12 1372-16 54-65 101-125 121-59 19-207 36-329
36h-92zm349-1494v-160h-520v320h520zm0-505v-145h-520v290h520zm0-470V680h-520v270h520zM5241
3259c-13-41-32-91-42-111l-19-38h190c113 0 199-4 211-10 18-10 19-25
18-428 0-327-3-413-12-398-86 134-182 272-253 361-111 139-348 376-483
484l-105 83-20-28c-12-16-45-58-75-93-47-56-52-65-36-73 41-24 218-163
302-240 161-145 301-311
423-500l60-93-370-3-370-2v-220h200V470h327l23-77c13-43 37-134
54-203l31-125 118 21c65 12 120 24 123 26 5 6-49 158-95 267-17 40-31
77-31 82s91 9 205 9h205l-2 1347-3 1348-27 47c-48 81-126 105-373
115l-150
6zm359-1469v-160h-520v320h520zm0-505v-145h-520v290h520zm0-470V680h-520v270h520z"/><path
d="M570 3242c0-5-31-46-68-93l-69-85 44-49c65-74 111-174 123-270 7-50
10-312 8-690l-3-610-207-3-208-2v-250h650l2 761 3 761 155-131c121-103
156-128 159-114 1 10 16 58 32 108 15 49 27 90 26 90-15 6-504 441-564
502-46 46-83 79-83 75zM4154 3206c-15-22-46-63-70-91l-42-50 45-50c24-27
61-84 81-124l37-75 3-688 3-688h-411v-250h640v760c0 418 4 760 9 760 4 0
77-59 161-131l154-130 12 48c7 26 22 74 33 105l20 58-237 207c-130
114-276 246-324 294l-87 86zM2616
2258c-44-208-135-505-215-702-23-55-39-101-37-103 6-7 186-56 190-52 12
14 121 287 160 399 59 169 120 400 109 410-4 4-46 20-93 35s-90 30-97
32c-7 3-14-6-17-19zM6226 2273c-3-4-6-16-6-27
0-67-124-474-206-679-24-60-44-111-44-113s30-12 68-23c126-37 118-38 142
8 92 182 278 749 252 772-5 5-92 35-189 64-6 2-14 1-17-2zM741
781c-67-98-221-294-325-411-36-41-65-78-64-82 2-4 39-34 83-68l80-60 102
105c121 124 255 283 321 379l47 68-45 40c-25 21-66 57-92 79l-47 40zM4369
808c-71-106-212-287-313-403-53-60-95-112-94-117 2-4 39-34 83-67l80-60
49 47c118 115 416 473 416 501 0 4-26 29-57 57-32 27-72 62-90 77l-32
28z"/></g></svg>
def perimeter(self):
sum_side = self.base_triangle + self.side_b + self.side_c
print("Периметр треугольника: {}".format(sum_side))
self.perim = sum_side
.....
self.keymap=
{Qt.Key_Left: _board.tryLeft,
Qt.Key_Right: _board.tryRight,
Qt.Key_Up: _board.tryRorateCCW,
Qt.Key_Down: _board.tryRorateCCW,
Qt.Key_Space: _board.dropDown,
Qt.Key_D: _board.tryLineDown}
........
def keyPressEvent(self, event):
key = event.key()
if key == Qt.Key_Escape:
self.paused ^= True
elif not self.paused and key in self.keymap:
self.keymap[key]()
else:
super(Tetris, self).keyPressEvent(event)