小编Jul*_*Wgs的帖子

python的电报内联键盘中的换行符

我的按钮文本太长,无法放入 python 电报机器人的内联键盘的一行中。"\n" 不行。

代码信息:/key 是它唯一能理解的命令。它从代码目录中的文件 token.txt 中读取 API 令牌。

这是我的代码:

from pprint import pprint
from telegram.ext import Updater
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler, Filters
from telegram.ext import InlineQueryHandler
from telegram.ext import CallbackQueryHandler
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram import InlineQueryResultArticle, InputTextMessageContent
import logging
import time, threading, pickle

file = open("token.txt", "r")
TOKEN = file.read()

updater = Updater(TOKEN)

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',level=logging.INFO)

dispatcher = updater.dispatcher

def start(bot, update):
    bot.send_message(chat_id=update.message.chat_id, text="I'm a bot, please …
Run Code Online (Sandbox Code Playgroud)

text python-3.x python-telegram-bot

6
推荐指数
1
解决办法
4778
查看次数

如何使用 python 将 .blf 数据从 CAN 转换为 .csv

我有来自 Vector 软件的 blf 格式的 CAN 数据。为了进一步调查,我想使用 python 将其转换为 csv 格式。

我到目前为止的进展:

import can
filename = "test.blf"
log = can.BLFReader(filename)
Run Code Online (Sandbox Code Playgroud)

我不知道那是不是正确的方法。我现在无法将“日志”保存到 csv 文件。

这可能有帮助

python can-bus type-conversion

4
推荐指数
1
解决办法
1万
查看次数

将 Jupyter Notebook 转换为原生 Python 中的 html 输出

我知道我可以打电话

jupyter nbconvert --execute --to html notebook.ipynb
Run Code Online (Sandbox Code Playgroud)

从 shell,或者从 Python 进行系统调用:

import os
os.system('jupyter nbconvert --execute --to html notebook.ipynb')
Run Code Online (Sandbox Code Playgroud)

nbconvert但是,当本机 Python 中存在可用模块时,必须通过系统调用来执行此操作似乎很奇怪!

我想编写本机 python 来执行 iPython 笔记本并将其转换为 html 文件。我研究了一些官方文档,但无法将它们拼凑起来。我的问题是:

  1. 是否有一个在本机 Python 中将笔记本转换为 html 的示例?
  2. 有令人信服的理由不这样做吗?

jupyter jupyter-notebook nbconvert

1
推荐指数
1
解决办法
2573
查看次数