python

Get the group's message history via the telegram api

I know that telegram has a method messages.getHistory, but how to use it? Off. the docks don't tell me anything. Or does this ... m just sends requests like /getMe or /setWebhook?<params>, and in the case of getHistory, the copy-paste does not roll.

Connecting Free-kassa to the Telegram bot

Good afternoon, everyone. I wanted to make a telegram bot in Python. If the user clicks on the button (the bot sends a messag ... ernet: Linking free-kassa to the telegram bot. And what kind of knowledge is needed for this? Thank you very much in advance!

Using yield in python generator functions

I have met such a variant of writing in generator functions: def gen(val): return (yield val) How does this differ from this option: def gen(val): yield val Why do I need to additionally write "return"?

Image search yandex images python

I need to implement image search using the yandex images service. Does Yandex have an api for this. Please watch the video: h ... earches for similar images. In general, the url that the bot uses has the parameter: token. This is usually seen in the api.

In the telegram bot when sending a file(photo) the bot flips the photo

First, here is the Bot code @bot.message_handler(content_types=['document']) def get_docs(message): file_info = bot.get_f ... ) I tried to change the format to .png (it didn't help) I also tried to convert via Pillow, then save it too (it didn't help)

How to remove the distance between blocks in QGridLayout when Fixed / maximum size of widgets?

If you try to limit the size of the widget, then only the horizontal space disappears when spacing=0, is it possible to remov ... dgets.QVBoxLayout(widget) mainbox.addLayout(gridbox) self.setCentralWidget(widget) self.setMinimumSize(500, 500)

How do I create a two-dimensional numpy array with a certain dimension?

I can't figure out how to create an array with a certain dimension, that's what I mean, that's how I create it now: A = np.a ... ad the documentation and didn't really understand the append method and the meaning of "axis". Please help me how to do this?

How to extract text из.doc a file?

You need to extract the text from the. doc file. How and with what library can I perform this task?

How to hide a link in a word in python 3 telegram bot

Hello everyone I want to say right away that I am new to Python and at first glance I came across an elementary thing. To th ... ll lead to telegra.ph another on the mirror tgraph.io. How do I implement this in code? Thank you in advance for your answer!

Why is the request executed under Windows, and under Linux error: "ORA-01722: invalid number"?

There is a Python / SQL script that is written under Windows. Everything is elementary simple, I execute the request and do ... rsor.execute(_SQL) Under Windows-everything is fine, and under Linux-an error Which way to look? What could be the problem?

How do I pass a list to a function argument in Python?

There is such a code and everything works in it as it should be: m=1000 t=10 #по ... e(x,h) integrFiltr(x) Now the output I get is an empty list y, and therefore the second graph is not plotted What's wrong?

NoneType error' object is not iterable

There is code that implements key-values storage. import argparse import json import tempfile import os STORAGE_PATH = o ... ng for an incorrect key, it returns an error elif args.key: for i in get(args.key): print(i, end=" ")

How to install python 3.7 on Ubuntu 20.04 LTS

On Ubuntu 20.04 LTS, python 3.8 is pre-installed, but I need python 3.7. How do I install it and choose this particular python interpreter and how to install modules there.

How do I install python 3.8 on ubuntu mate?

The system already has two versions of python 2.7.17 and python 3.6 How to install version 3.8. separately, to switch or update version 3.6? Without breaking the system. Or with the installation in siblime.

Substituting their own values in the ForeignKey fields for ModelForm Django

Faced with the problem of output of human-readable values from ForeignKey via the ModelForm form. ForeignKeys are output as D ... s-adds entries to the Order table with a ForeignKey But it looks like this: And it should look like this and still work:

How to read the file.xls obtained from the internet?

I'm trying to read the file .xls obtained from the internet using requests to later turn it into an array or list of dictiona ... still save the file. In general, now the question is how to feed the xld type bytes to the library so that it sees it .xls?

How can I calculate the number of days between two dates in Django so that I can calculate the amount for my stay?

There is an app for online booking in Django. You need to make a function that will count the difference between two dates ( ... erbose_name="Дата отъезда") ? days_ is_verificated = models.BooleanField(default=False, verbose_name="Подтверждён?")

Change the python version in windows 10

Actually, I have 2 versions of python in my system(win 10), I need both. How can I switch them? In the situation on the scree ... d that you need to change something in the PATH system variables, but what exactly, I did not find any sensible information.

How do I fix the IndexError: list index out of range error?

Given an integer array of size N that does not contain the same numbers. Check whether its elements form an arithmetic progre ... i] != d: flag = False i += 1 print(d if flag else 0) Returns an error: IndexError: list index out of range

Explain the Python one-line

Solved the problem on HackerRank. The problem is as follows: the input is the number n, you need to output the Fibonacci numb ... 1)%(2<<n) print(fib(int(input()))) The result of this code is correct, but how it works I absolutely do not understand