python

When parsing in python3 via beautifulsoup error 400 bad request what to do?

Parsed the online store with authorization and through BeautifulSoup, but stably after 226 requests, every second request gives an error 400 bad request, what to do?

Help with the function in Python

Hello everyone I'm trying to write a function that would: If the number is a multiple of 7, then the number is a multiple of ... ish the number originally entered from the nearest one...in another way, I can't implement =\ Thank you very much in advance!

python what does return do

Tell me, what exactly does return return and how to access it? import ctypes EnumWindows = ctypes.windll.user32.EnumWindows ... I understand that prints are running != empty windows. But, if I remove return in def main (): the result does not change.

Keyboard input freezes when working with keyboard/mouse input libraries

I'm trying to make Anti-AFK in Minecraft, the essence is that when you press F7, Anti-AFK is turned on and the character runs ... pyautogui.moveRel(-782, 0) pydirectinput.keyUp('w') print('Anti-AFK is ending') obj = Main()

How to check if a Python 3 number is prime

Goodnight! I just started training, and here is homework that I can't do for 6 hours) The homework actually sounds like this: ... (a): if a % a == 0 and a != 0: return True else: return False A = int(input("Enter a number: ")) print(is_prime(a))

How to fix RecursionError: maximum recursion depth exceeded in instancecheck

There is a part of the code class Creat_Timetable(): def __init__(self): self.all_hours_start = [8,9,10,11,12,1 ... cnfmerge elif isinstance(cnfs, (type(None), str)): RecursionError: maximum recursion depth exceeded in instancecheck

Record text from one.txt to another.txt Python 3

Hello everyone There are three .a txt file with a different number of lines of text in each. We compare the number of lines i ... ppens is when I copy the text from the file and paste it just into write() everything goes away of course. I'm just learning.

Who can explain the meaning of the While True loop in Python?

How can I understand what While True means: ...? I only realized that the loop will be infinite in this case until I write th ... hout a break, for example if "something" becomes False :D Maybe the question is stupid, but thanks to the one who answers :D

Replacing the for in range loop with while python

Please tell me how to replace the for in range loop with while? def what (a, b): res = a for i in range(b): res = res + 1 return res

There are inline buttons "like", "dislike" Telegram bot. How do I change the value of a button after clicking on it?

I decided to put the variables quant1 and quant2 in the rows of buttons. But I don't know how to change them by clicking on t ... likes_count == 0: pass likes[query.from_user.id] = likes_count # обновление количества лайков в хранилище

Parser for Avito

I am writing a parser for avito in Python in PyCharm. A question arose. Is it possible to make a parser for all categories? T ... ries are different), will this work? I apologize, so often the "parser" in one letter has not been written for a long time.

Call a class method in the same python class

I'm teaching oop in python, I ran into an error that I don't understand. I want to call the class method inside of it, but I ... ef __init__(self,name='Alex'): self.name=name def prnt(self): print(self.name) self.prnt() p1=Cat()

Parsing a python html page. BeautifulSoup

Hello everyone I was faced with the task of parsing data from this web page. It contains data on the works put up for auction ... " from the screen), type2 (="Print in colors"), width (75), height (80), and hummerprice (="not communicated) are left blank.

BeautifulSoup-site parsing

import requests import csv from bs4 import BeautifulSoup url = 'https://www.zakon.kz/news/page/3' def parse(url): news ... print(parse(url)) I can't understand what the problem is, why the information is not written correctly to the csv file.

How to send a photo to Python mail

You need to send a screenshot made with PIL + text to the mail. I looked through the documentation, the text is easy to send, but problems start with the png image.(mail.ru, gmail)

when parsing beru.ru responds with errors: '403' or 'Connection aborted'

When trying to parse the site beru.ru errors are returned: 403: import requests from bs4 import BeautifulSoup import tim ... ible that your computer is infected with malware that automatically accesses To Yandex."etc. Zarenee thank you for your help

Python pull variable values from the dictionary

{"status":"success","result":[ {"picture":"data:image\/png;base64,","name":"\u0420\u0430\u0437\u0431\u0430\u043d","username": ... , end=" ") print("username{}:".format(index), i["username"]) index += 1 time.sleep(1000)

The Discord bot does not start

CODE: import discord client = discord.Client() @client.event async def on_ready(): print('We have logged in as ') @clie ... ent loop is closed') RuntimeError: Event loop is closed I wanted to create a discord bot (according to their documentation)

Python - problems with utf-8 encoding

How do I get python to work with utf-8 encoding? The file.pyc file is generated (or not generated, I didn't understand it my ... blem still turned out to be in Apache. The solution was found tut AddDefaultCharset UTF-8 SetEnv PYTHONIOENCODING utf8

Why doesn't it parse the html page?

I'm learning Python and the Beautiful Soup library. I want to parse hot airline offers. But I don't see the text in the outpu ... 0].text) As a result, I get a response from the scripts, the text is not there. Help please. Thank you very much in advance.