小编Mig*_*Mag的帖子

如何使用 telethon 将图像下载到本地 PC

我看过所有询问有关电视马拉松的条目,但没有一个回答我的问题。

我想要实现什么?我想将图像从 telegram 频道下载到我的电脑中

到目前为止我做了什么?我能够创建一个客户端并读取包含图像的消息。但是,在 download_media 之后,我不知道文件在哪里或如何继续。

注意:我不想使用任何 BOT。

这是我的代码:

import configparser #read API credentials from a config file
import json         # dump data into JSON formatted files.

from telethon import TelegramClient
from telethon.errors import SessionPasswordNeededError

from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import (PeerChannel)

from telethon.tl.functions.messages import (GetHistoryRequest)

from telethon import utils

#**************** CREATE TELEGRAM CLIENT ******************************
# Reading Configs
config = configparser.ConfigParser()
config.read("E:\TelegramBOT\config.ini")

# Setting configuration values
api_id = config['Telegram']['api_id']
api_hash = config['Telegram']['api_hash']

api_hash = …
Run Code Online (Sandbox Code Playgroud)

python telegram telethon

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

在Python中从MATLAB模仿ode45函数

我想知道如何将MATLAB函数ode45导出到python。根据文档应如下:

 MATLAB:  [t,y]=ode45(@vdp1,[0 20],[2 0]);

 Python:  import numpy as np
          def  vdp1(t,y):
              dydt= np.array([y[1], (1-y[0]**2)*y[1]-y[0]])
              return dydt
          import scipy integrate 
          l=scipy.integrate.ode(vdp1([0,20],[2,0])).set_integrator("dopri5")
Run Code Online (Sandbox Code Playgroud)

结果是完全不同的,Matlab返回的尺寸不同于Python。

python matlab scipy differential-equations ode45

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