python-3.x

How to kill a process running through subprocess?

I am writing a program that starts and stops a Python script via another Python script at the user's request. And wrote the f ... startupinfo) FileNotFoundError: [WinError 2] ═"непонятные символы" Question: What am I doing wrong and how can I fix it?

help with the python parser

On the site http://burlang.ru/ you need to insert a word in Russian in the input field, and save the resulting translation. H ... l', class_='translate-list') print(items) def parse(): html = get_html(URL) get_content(html.text) parse()

Python Try Except. Handle 2 identical exceptions in a row

I'm writing a parser for a site where blocks have different names on different pages in the same place. I try to work around ... t AttributeError: # Если нет и "gray db rowspan", то запиши "неогранич." db_count = 'неогранич.' print(db_count)

You need to extract the Russian text from the pdf

You need to extract all the text from the given PDF file. I use the following code: import PyPDF4 pdf_file = open('1.pdf', ... ct the text from an English-language file, everything went as it should). How can I extract Cyrillic text from a PDF file?

Configuring run in PyCharm

No matter how much I Googled, I didn't find how to make the buttons work on the top right (circled). That is, so that the code can be run directly in pycharm. Screenshots of the settings are immediately available. Buttons that don't work

Python. Hashlib. How do I convert a hash string to an md5 hash object?

I want to speed up the brutus of passwords in the dictionary. Now hashlib.md5(word.encode('utf-8')).hexdigest() is executed o ... that I can discard .hexdigest() and make a comparison between two md5 hash objects, rather than between hexadecimal strings?

Copying files using shutil. copy()

Such a task: there is a dataset consisting of folders, each of which has a certain number of images. You need to find the max ... os.path.join(dir_path + folder)) files_num = len(os.listdir(path=os.path.join(dir_path + folder)))

the Gaussian method in python 3

I need to complete a task: The Gauss method on python. Actually, I implemented the algorithm itself, there is nothing complic ... myB= input("Введите матрицу правых частей") But it gives the error Not can you tell me how to fix it? Thank you in advance!

Pandas error: KeyError: "None of [Index (['Binary'], dtype= 'object')] are in the [columns]"

CSV file table: Binary 16_bit 0 0 0 1 1 1 2 10 2 3 11 3 4 ... ry'] y = dataset['16_bit'] print(x) Mistake: KeyError: "None of [Index(['Binary'], dtype='object')] are in the [columns]"

Python error: "int object is not iterable"

Task: Given 20 numbers that create a sequence. Multiple digits those who write in a row are equal to each other. 1)Find ... numbers.append(n) print(n, end=',') print() for i in n: if n[i] == n[i-1] == n[i+1]: k += 1 print(k)

How do I get data from a linked model?

I need to display a list of products on the main page of the site. The problem is that I do not know how to display the produ ... %} Question : How to get queryset product photos to display them on the product list page.(Random or first of each product)

Python 3: error 'name' ... ' is not defined"

I want to make a certain "autostatus" for the bot, I use it. to do this, str(status_message_from_cycle) sets its value in the ... init self.status_message = str(status_message_from_cycle) NameError: name 'status_message_from_cycle' is not defined

Python Anagram Search (Optimization)

There is a task where you need to find the number of pairs of anagrams.I wrote the code using Counter, but it works too slowl ... range(n): tmp.append(input()) for i in range(n): x = tmp.pop(0) comparing(tmp,x) print(comparing([0,0],-999))

Remove the first and last character from the string

As far as I know, the strings are unchanged, so I will use the .replace () a = 'hello' def remove_char(s): s = a.replac ... ove_char(a)) But the function returns 'hello' unchanged. I understand you can't use the .replace method with two arguments?

Python. Creating a list class based on an array

Good afternoon. I have not been in oop in Python for quite a long time(if I may say so), and in connection with learning this ... rridden by [<classes.ChildClass_1.Car object at 0x03DA9E30>, <classes.ChildClass_1.Car object at 0x03DCE610>]

How do I close a window and open a new one in Pyqt5?

I have a game menu on pytq. When you click on the start game button, the window where the game should be opens and the main m ... the function itself closes the window of the Main () class, which creates the menu and whose method is the go_start function

re. sub error: "TypeError: expected string or bytes-like object"

import re mystr = ['234egfdgf'] mystr = re.sub(r"[egfdgf]", "", mystr) Mistake: return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object Should work

Copying text from the Label widget to the clipboard

from tkinter import * root = Tk() lbl = Label(root, text='hello world') btn = Button(root, text='copy') lbl.grid(row=0, col ... aw copying from the Scrolledtext widget, but it doesn't work that way with Label. How do I copy text from Label to clipboard?

NOT NULL constraint failed: studentapp studentproject.project owner id

Model: from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import ... rors, status=status.HTTP_400_BAD_REQUEST) Mistake: NOT NULL constraint failed: studentapp_studentproject.project_owner_id

How to save a file via python (requests module)

There is a link that points to the page from which the file with the information should be automatically downloaded. To do th ... pic.org/media/attachments/course67/3.6.3/699991.txt <built-in method read of _io.BufferedWriter object at 0x03475228>