list_1 = [1, 2, 3]
list_2 = [4, 5, 6]
list_3 = [7, 8, 9]
lists = {
'list_1': list_1,
'list_2': list_2,
'list_3': list_3
}
for list_name, list_values in lists.items():
for value in list_values:
print(f"Value: {value} from {list_name}")
Value: 1 from list_1
Value: 2 from list_1
Value: 3 from list_1
Value: 4 from list_2
Value: 5 from list_2
Value: 6 from list_2
Value: 7 from list_3
Value: 8 from list_3
Value: 9 from list_3
class Session_cinema(db.Model):
film_id = db.Column(db.Integer(), db.ForeignKey('film.id'))
...
film = relationship('Film')
<td>{{ item.film.name }}</td>
if 'слово1' in string:
# сработало первое
return True
if 'слово2' in string:
# сработало второе
return True
if 'слово3' in string:
# сработало третье
return True
words = ['слово1', 'слово2', 'слово3']
for word in words:
if word in string:
# найдено word
return True
sql = "INSERT INTO groups(group_id, group_name, short_link) VALUES (%s, %s, %s)" , (gid, name, screen_name)
print(type(sql))
sql = "INSERT INTO groups(group_id, group_name, short_link) VALUES (%s, %s, %s)" % (gid, name, screen_name)
print(type(sql))
sql = "INSERT INTO groups(group_id, group_name, short_link) VALUES (%s, %s, %s)"
cursor.execute(sql, (gid, name, screen_name))
sql_prepared_text = "INSERT INTO groups(group_id, group_name, short_link) VALUES (%s, %s, %s)", (gid, name, screen_name)
cursor.execute(*sql_prepared_text)