python

How to make a Telegram bot send music in Python

Should send using the send_audio function, but does not send. Maybe my error is in the function open where I wrote rb. How sh ... (chat.id, audio) else: bot.send_message(message.chat.id, 'Бла-бла') bot.polling(none_stop=True)

How to make the program run for a certain time

For example, I have a loop: while True: print(1) How can I make it run for 30 seconds, and after 30 seconds it stops, and another loop starts?

Error ValueError: invalid literal for int () with base 10: '6.56' in python

Https://pastebin.com/dkKZx3PS - code import math from colorama import init from colorama import Fore, Back, Style init() ... with "k = int(d)", but if anything I will remove it. Only three rounding doesn't work, everything else works. Please help me.

Enabling css in a Django template

Good day to all! I have a project" proj " on Django, it created an application "blog". In the file "..../proj/blog/templates/ ... pecify the path that would be when calling render_to_response('page.tpl', context) Did the generated page find the css file?

Compare the list with ManyToMany in Django

The list members is given. It contains instances of the User class. You need to check whether all the elements of this list a ... quest.user] if Dialog.objects.filter(members=members): # Проверка на идентичность списков return redirect('/')

How to pass a list to a Python function argument

Hello, there is a code: num = [33,34,35,36,50] num_my = [33,36,50] num_res = [] '''Цикл проверяет повторяеться ли цифра 'nu ... append(number) return num_res num_1 = (result([54,24,1,2,3])) num_2 = (result([34,1,3])) print(num_1) print(num_2)

keyboard.on press key () stops calling the function after compilation в.ехе

Keyboard. on_press_key('f7', TranslateAll, suppress=True) when pressed on F7 calls the function TranslateAll(). Algorithm o ... also be downloaded from my Google drive: PythonCode.exe There is also a video with a detailed overview of the problem: video

How to fill in Google tables via the python api

I fill in Google tables using the api, there should be four columns,the data changes during the script, how do I make the tab ... eadsheet_id, body={ "valueInputOption":"USER_ENTERED", "data":[ {"range": ] } )

Python. How do I make a delay without freezing the program?

When using time. sleep(x), the entire program stops. I also make a bot in which you need to wait after each action. You can't ... ops the ENTIRE program, and after each operation, no one can use the bot. How do I make a delay without freezing the program?

Pycharm keyboard shortcuts

Is there a multiple selection function in pycharm like in sublime text(you can put many cursors and simultaneously edit text ... us and in paycharm itself, for example Ctrl + Alt + l in pycharm should run reformat code but in linux it blocks the screen.

Python Tkinter Color Text

I want to implement color output as in the picture, but not in the console, but in the tkiter ' s label. Is there such a poss ... l(window, text='normal text\nred text') lbl.pack() window.mainloop() The picture shows an example from the colorama module

How to make the telegram bot write in bold?

Please tell me how to make a telegram bot write in bold ? For example, how do I make the BSUT Helper v0.1 Alpha bot write in ... per v0.1 Alpha.\nПоследнее обновление: 18.11.2020\nДата выхода: 18.11.2020\nРазработчик @mikitos59', reply_markup=keyboard2)

Parsing videos from Youtube channel (Python, BeautifulSoup, requests)

There is a code like this: from bs4 import BeautifulSoup import requests ycid = input('Введите код-идентификатор канала: ') ... nDX1UoRzAHYgNg Парсим с канала: https://www.youtube.com/channel/UCviSYAcwdnDX1UoRzAHYgNg [] [] [] How can I fix the code?

How to sort GridSearchCV.cv results

I'm taking a course in data science and they use the sklearn library, where there is a GridSearchCV method, the problem is th ... ain_fin, y_train_fin) sorted(gridsearch.cv_results_,key = lambda x: -x.mean_validation_score) What could be the problem ?

Automatic receipt of the VKontakte authorization token in Python

I use the library: Https://github.com/sgaynetdinov/py-vkontakte Import vk Api = vk.Api('YOUR_TOKEN') Where a token is used fo ... om/blank.html#access_token=YYY&expires_in=86400&user_id=XXX Please tell me how to automatically get a token in Python

The Python parser doesn't work

If you turn on the code, it will work for a couple of seconds, while not displaying anything, and then it will turn off. The ... ).get('href') }) for video in videos: print(f"Ссылка на видео - {video['link']}") parse_of_video()

bs4 problem with the td tag

How to parse and write in the table under the tag td a href? import requests from bs4 import BeautifulSoup import csv count ... s e: print(e) Returns an error: 'NoneType' object has no attribute 'find_all' name 'adr' is not defined

I can't install kivy. python

Before entering python-m pip install kivy, I entered this: python -m pip install --upgrade pip wheel setuptools virtualenv ... pip install docutils pygments pypiwin32 kivy_deps.sdl2 kivy_deps.glew Everything was updated and installed except for kiwi.

What data structures do standard python containers use?

Where can I find out what data structures are represented by containers: string, list, tuple, set, dict or what asymptotics d ... is working with a large amount of data and knowing which operations are expensive and which are not is quite useful to know.

Tkinter grid grid

Omogite deal with the grid in tkinter grid. I need raduibutton to be all in one smooth column, but it turns out in a discrepa ... ue to the fact that in the column next to a large button, how to make sure that the grids do not interfere with each other