我的按钮文本太长,无法放入 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) 我有来自 Vector 软件的 blf 格式的 CAN 数据。为了进一步调查,我想使用 python 将其转换为 csv 格式。
我到目前为止的进展:
import can
filename = "test.blf"
log = can.BLFReader(filename)
Run Code Online (Sandbox Code Playgroud)
我不知道那是不是正确的方法。我现在无法将“日志”保存到 csv 文件。
这可能有帮助
我知道我可以打电话
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 文件。我研究了一些官方文档,但无法将它们拼凑起来。我的问题是: