<html lang="en"><head>
<meta charset="UTF-8">
<title>
Главная
</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;800&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-sm navbar-white">
<a class="navbar-brand text-center" href="/">ТестСайт</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav ">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="/p/"><i class="fas fa-donate"></i> Статьи</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="main">
<div class="container">
<div class="main__page">
<div class="row">
<div class="col">
<h1 style="margin: auto;">Lorem</h1>
</div>
<div class="col">
<p style="font-size: 30px; margin: auto;">Ipsum</p>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
</body></html>
主页
/
user-380800
Borzoff's questions
@bot.callback_query_handler(func=lambda call:True)
def callback_inline(call):
if call.data == "test":
bot.send_message(message.chat.id, "hello")
NameError:未定义名称“消息”
import datetime
import requests
from bs4 import BeautifulSoup
from bs4 import BeautifulStoneSoup
import telebot
import time
bot = telebot.TeleBot('token')
@bot.message_handler(commands=['start'])
def startmess(message):
sendmessstart = f"Привет {message.from_user.first_name}!\n Введите команду rub чтобы узнать курс доллара в рубли"
bot.send_message(message.chat.id, sendmessstart)
@bot.message_handler(commands=['rub'])
def send_text(message):
DOLLAR_RUB = 'https://www.google.com/search?q=%D0%BA%D1%83%D1%80%D1%81+%D0%B4%D0%BE%D0%BB%D0%BB%D0%B0%D1%80%D0%B0+%D0%B2+%D1%80%D1%83%D0%B1%D0%BB%D1%8F%D1%85&oq=%D0%BA%D1%83%D1%80%D1%81&aqs=chrome.0.69i59l2j69i57j0l2j69i61l3.1190j1j7&sourceid=chrome&ie=UTF-8'
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'}
full_page = requests.get(DOLLAR_RUB, headers=headers)
soup = BeautifulSoup(full_page.content, 'html.parser')
convert=soup.findAll("span", {"class": "DFlfde", "class": "SwHCTb", "data-precision": 2})
rub = (convert[0].text)
chatid = message.chat.id
bot.send_message(chatid, rub)
bot.polling(none_stop=True)
Python IndexError:列表索引超出范围