#!/usr/bin/env python
# pylint: disable=E0611,E0213,E1102,E1101,R0913,R0904
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2022
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram Bot."""
import functools
import logging
import warnings
from datetime import datetime
from typing import (
TYPE_CHECKING,
Callable,
List,
Optional,
Tuple,
TypeVar,
Union,
no_type_check,
Dict,
cast,
Sequence,
)
try:
import ujson as json
except ImportError:
import json # type: ignore[no-redef] # noqa: F723
try:
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
CRYPTO_INSTALLED = True
except ImportError:
default_backend = None # type: ignore[assignment]
serialization = None # type: ignore[assignment]
CRYPTO_INSTALLED = False
from telegram import (
Animation,
Audio,
s='AnyAharacters(((((( AnyAhrr22aracters&#+-123(((( Взять zz(()))только этот текст ))'
r='.*\(\s(.*)\){2}$'
re.match(r,s)
Out[36]: <_sre.SRE_Match object; span=(0, 82), match='AnyAharacters(((((( AnyAhrr22aracters&#+-123(((( >
re.match(r,s)[1]
Out[37]: 'Взять zz(()))только этот текст '
s2="AnyAharacters(AnyAharacters&#+-123( Взять только этот текст ))"
re.match(r,s2)[1]
Out[44]: 'Взять только этот текст '
i=[i.find_element_by_tag_name('a').get_attribute('href')[26:-1] for i in all_urls]
i=[x[26:-1] for x in i]
list (some_list[0].keys() )
[(i, list(some_list[i].keys())[0]) for i in some_list]
l=[wb['Sheet1']
['B'+str(row)].value for row in range (2, wb['Sheet1'].max_row+1)
if (wb['Sheet1']['B'+str(row)].value)!=None]
len (l)
import os
from os import walk
dir1='xxxxxxxxx'
f = [] #список куды будут добавляться имена файлов из dir1
for (dirpath, dirnames, filenames) in walk(dir1): #dirpath - путь к директории, не нужен, dirnames - имена вложенных директорий, не нужны, filenames - имена файлов
f.extend(filenames)
break
print (f)
df1=pandas.read_excel(путь, header=0)
print (df1.loc[df1['Боец']=='антон'])
List=df1.to_numpy().tolist()
urls.+(\[.*\]);\n
" , "
student = ["Вася", "Петя", "Ваня", "Света"]
s1=s=['(print (\"Все студенты на месте. Начинаем занятие!\")) if ( "'] +['" and "'.join(student)]+['\" in student) else ( print (\"Отсутствующие к экзамену допущены не будут\"))']
s2=''.join(s1)
eval(s2)
p1.loc[p1['height]==p1['height'].max()]['name']
p1.loc[p1['height]==p1['height'].max()]['name'].tolist()
p1.loc[p1['height]==p1['height'].max()]['name'].values
, если, например, известно, что нужно взять только первое ..values[0]. Если, конечно, известно, что оно будет существовать cur = con.cursor()
sql = 'INSERT INTO base_url(url, name) VALUES("{}", "url")'.format(element) # здесь element является url адресом, а url это просто обозначение для второго столбца name
print (sql)
cur.execute(sql)
con.commit()
con.close()