python-3.x

How do I find out the category id? (discord.py)

How to find out the id of the category by its name, for example: the category is called "Main" and it is necessary that after ... f"{OSNid}", reason=None) await ctx.guild.create_text_channel(f"TEST8", overwrites=None,category=f"{OSNid}", reason=None)

The Euler project, task 42

I decided to solve problems from the Euler project, I came across an interesting problem (https://euler.jakumo.org/problems/v ... (triangle_number(g)) if score in temp: triangle_words.append(i) break print(triangle_words)

Counting the number of all palindromes in a string

Help me solve the problem. The function counts the number of all palindromes in a string (single-letter ones are also counted ... t = s[i:j] r = ''.join(reversed(t)) if t == r: res = res + 1 return res

The OpenCV Python face recognition method doesn't work

The problem is this. I did facial recognition for example. And then-bang! and knocks out an error. And specifically in the me ... is somewhere inside the library. How to solve it? I did everything according to the example that is everywhere. What's wrong?

Encoding problem in Python

self.api.messages.send(peer_id=i, random_id=0, message='({group}) {rang} - {user} , добавил ГДЗ к предмету - "{subject}"! ... ke/mainBot.py on line 131, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details What should I do?

Python Automorphic Numbers

We need to solve this problem in Python: A natural number is called automorphic if it is equal to the last digits of its squa ... : print(i) The program does not work as it should. For example, when entering 25, it outputs 76, which is incorrect

Different Python colors

I have a problem. I need to create a list colors in which every три value is a color rgb. That is, the first three elements o ... colors are not repeated. That is, so that no two rgb values are the same. It is advisable to give an example with the code.

problems with establishing a connection with the telegram bot

I learned to write bots in telegram using the telegram bot module, there were many errors, despite the fact that I wrote a di ... tent_types=['text']) def lalala(message): bot.send_message(message.chat.id,message.text) bot.polling(none_stop=True)

Error when sending a vk api message by the bot

When the bot sends a message to the user, it crashes with the error: vk_api.exceptions.ApiError: [901] Can't send messages fo ... ser_id=event.obj.from_id, random_id=get_random_id(), message=event.obj.text)

not all arguments converted during string formatting

The code itself: x = str(input()) if (x % 4 == 0 and x % 4 != 0) or (x % 400 == 0): print ("Високосный") else: p ... learning and I don't understand what's going on. x is converted to int, but input probably returns a string for some reason.

'OWM' object has no attribute 'weather at place'

import pyowm owm = pyowm.OWM("ba791ca513afc4f135cdc07cbe59815b") place = input(">> ") observation = owm.weather_at_p ... object has no attribute 'weather_at_place' I tried to connect it this way from pyowm import OWM but it also doesn't work...

Hyperlink in the message

I tried the following code: await ctx.send("`uwu`\n\nUsage = `sun.uwu <[arg1]>`\n\nNOTE: " + ["Sunrise"]("https://disco ... d, the TypeError comes out. Please help, preferably by explaining how to add a hyperlink to a message. Solved: solution below

Discord.py deleting all messages in a text channel

I've been trying to clear messages (everything) in my Discord bot for a long time using the command: /clear, but it doesn't w ... ): await client.delete_message(msg) What am I doing wrong? I just close the file (when opened). Please help me!

How to get a list of all discord server members (discord.py)

How can I write all the server participants to a list? I tried it like this: @bot.command() async def members(ctx): for ... for member in guild.members: await ctx.send(member) But it only gave out the nickname and tag of my bot

Get text from Embed in in discord

Writing a bot discord.py . I have an Embed and there is text in the description. I need to convert it to plain text. How to d ... u need to get the "text that needs to be intercepted". In general, it is better to use the entire text. Thank you in advance.

Python Voice Assistant

Making a voice assistant with this video: https://www.youtube.com/watch?v=YeS755SPSI8&t But it is not possible to install ... . whl Writes: ERROR: PyAudio-0.2.11-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform. What should I do?

Calling the init method for multiple inheritance

I'm studying multiple inheritance. I don't understand why in one case the init method of both parents is called, and in the o ... y one init is triggered, and in the other case all possible inits are triggered. Thank you in advance for your explanations.

Clear the python console in PyCharm

I am writing a simple reinforcement learning algorithm, which has a simple animation, via output to the console. So, to show ... in the cell. The matrix is updated and a new frame is output. Now n=7. The total number of frames cannot be known in advance.

python3 --version-outputs python 3.8.5, while I have already installed 3.9

Dear community! Actually, the problem I encountered is described in the title. I installed python 3.9 via sudo apt install, b ... or use some other command to install python 3.9, and why I can't see version 3.9 on the command python3 --version. Thank you.

Screenshot of the entire page

I found the following code on github. As I understood, it should do a screen of the entire page, but it only does the visible ... newPage() page.goto('http://yandex.ru') page.screenshot(path=f'example-{browser_type.name}.png') browser.close()