index = abc_values.index('maxvalue')
s = ['A', 'B', 'C', 'B', 'A', 'D', 'D','D','A','B']
abc = {}
for i in range(0,len(s)):
if s[i] == 'A':
if s[i+1] in abc.keys():
abc[s[i+1]] += 1
else:
a = s[i+1]
b = 1
abc.update([(a,b)])
abc_values = list(abc.values())
maxvalue = max(abc_values)
index = abc_values.index(maxvalue)
abc_keys = list(abc.keys())
print(abc_keys[index]) #B
TypeError: 'int' object is not callable
max = 1
def setup_method(self, method):
""" setup any state tied to the execution of the given method in a
class. setup_method is invoked for every test method of a class.
"""
@pytest.fixture
def my_service():
# some setup logic
service = Mock()
...
return service
def some_test(my_service):
...
UPDATE chats SET {name1}={value1}, {name2}={value2}, ...., {nameN}={valueN} WHERE chat_id = {chat_id}
root1 = Node(1)
cur_node = root1
for i in range (0, 1000):
cur_node.left = Node(i)
cur_node = cur_node.left
root1 = Node(1)
root1.right = Node(2)
root1.right.right = Node(3)
root2 = Node(3)
root2.left = Node(2)
root2.left.left = Node(1)
result_vk_user_id = cursor.fetchall()
Такой селект выводит вот такую ерунду:
[(323826602,)]
result_vk_user_id[0][0]
result_vk_user_ids = [rec[0] for rec in cursor.fetchall()]