python - 我如何将数据发送到电报?
问题描述
我尝试将一些数据帧结果发送到电报机器人。你可以帮帮我吗?
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
from datetime import date
import telegram
tmp = pd.read_excel('sto_list.xlsx')
tmp = tmp[~tmp['Site address'].isna()]
tmp = tmp.reset_index(drop=True)
outcome = []
for add in tmp['Site address']:
html_get = requests.get(add)
html = bs(html_get.text, 'html.parser')
try:
opening = html.find_all(attrs={'name': 'opening-hours'})[0].text
if opening[-6:] == 'Closed':
outcome.append('Closed')
else:
outcome.append('Open')
except IndexError:
outcome.append('Invalid address')
fout = pd.concat([tmp, pd.DataFrame(outcome, columns=['Open'])], axis=1)
print(fout)
bot = telegram.Bot(token='token')
bot.sendMessage(chat_id=000000, text)
解决方案
推荐阅读
- sql - 我应该在哪里修改?
- sybase - 如何创建本机 Sybase BCP 文件?
- swift - 快速帮助缺少完整说明
- php - 如何使用 PHP 添加 active 包括 OR
- flutter - 如何在windows10的c分区中构建flutter apk
- java - Java:编译器如何使用声明类型作为其超类的表达式找不到特定方法?
- python - 如何从 Python 多处理进程中打印?
- php - opencart错误致命错误:未捕获异常:错误:未知列
- javascript - Json 对象到对象
- kotlin - 由于 jsNpm 配置,KMP 库 gradle allTests 失败