python-3.x

Getting command line output

import os,subprocess command=r'pyinstaller C:\Users\user\Desktop\Питон\hello_world.py' output=os.popen(command) print(output. ... same: output=subprocess.Popen(command,stdout=subprocess.PIPE) print(output.communicate()[0].decode('utf-8')) >>>

How to convert symbolic calculations to numbers in python

I tried converting the string "-5/x" to an integer and a floating-point number, but failed. Who can help? Sample code: y = in ... imer) % 0.5 or float(primer) % 1: end_spisok.append(float(primer)) i += 1 print(end_spisok)

'int' object has no attribute 'recv'

I try to make two functions run simultaneously using threads, and it returns a data type error, although it does not return a ... equest_data_thread = threading.Thread(target=request_data) connect_thread.start() request_data_thread.start() sock.close()

How do I round the edges of an image?

I am learning how to make applications in PyQt5, and I have a task to round the edges of the image. Is there any way to do ... e(140, 140)) box = QtWidgets.QHBoxLayout() box.addWidget(button) window.setLayout(box) window.show() sys.exit(app.exec_())

PyQt5 QTreeWidget-working out the click on the tree elements

I build a tree and output it to QTreeWidget (https://clip2net.com/s/450X4zs) thus: def treeRubrics(self): self.treeL ... ach list item where was your ID put down and it was returned when you clicked on it? Thank you to everyone who will tell you!

How do I get data from a Treeview?

How do I open a window when I click on the Treeview Tkinter line? That is, the user clicks on the line with the data he needs ... database to a separate window, but I don't understand how to take data from the selected row in the Treeview. Please tell me

Patterns in Python

I have heard different opinions about patterns. I'm not talking about patterns in Python, but patterns in general. That half ... and Python is flexible enough not to need such tweaks? If it is worth studying them, then which 5-10 should be studied first?

Where can I write Python 3 programs with the interface?

I'm new to YAP Python. The second month of training. I learned all the basics, etc., I want more. Where I can write programs in python with the interface? Is there anything similar to Visual Basic? Thank you in advance

how do I change the windows 10 theme via python?

Example of a windows theme that needs to be changed via python

Python. Instagram. How do I like it?

I found a feature that performs authorization on Instagram. import requests, json, getpass USER_AGENT = "Mozilla/5.0 (X11; ... l be logged in. How do I like it? Link to like - " https://www.instagram.com/web/likes/{MediaID}/like/". Thank you very much!

I can't start the bot with aiogram, most likely the problem is in aiohttp

I can't start the bot in aoigram Returns an error: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-p ... c def start_command(message: types.Message): await message.reply('Тест') executor.start_polling(dp) Python version: 3.8

How does getattr work?

Please explain where does 4 come from and how is it passed to the list? The main question is about 4, and not the general alg ... d the attributes of the called method are passed there (i.e. 4), but not here, but at the same time they were passed somehow.

How do I calculate the average value for a condition?

There is a people table with columns in it ID, Sex. There is a table cars with columns ID ID_person and Price. How can I calc ... 65000 4 4 Subaru 300000 You need to get the average value from 100000 and 65000. How do I get this one digit?

selenium --headless Chrome Canary

How to use selenium with the --headless argument for Chrome Canary and where to get webdrive for it? from selenium import web ... tions import Options c = Options() c.add_argument('--headless') d = webdriver.Chrome(options=c) d.get('https://yandex.ru/')

discord.py and youtube dl audio playback without jumping

How can you play audio in a bot using the youtube_dl library, but without installing the audio itself in the bot's directory ... ntly, and given that the audio launch is instant, and bots are very popular, then clearly this happens without jumping video)

Find the perimeter of the polygon

The task looks like this: But maybe I'm doing something wrong, can you tell me? from math import * a = [] while True: ... = 0 n = len(a) / 2 print(n) for i in range(1, n): sum = (a[i] - a[i - 1]) ** 2 len += sum i += 1 print(sqrt(l))

Converting keyboard layouts

Greetings to all. I use this function to press a key in a certain window: win32gui.PostMessage(self.hwnd, win32con.WM_KEYDO ... d. How can I convert Russian keyboard characters to English? Type: HI -> GHBDTN Maybe there is some table for this?

Automatic generation of UML diagrams from Python code

I'm completely lazy for self-isolation. I need to build an Action Diagramm in UML for a Python class. Of course, having a cod ... . That is, I only output a list of input variables... Tell me, I'm sure there must be some kind of add-on over PyCharm....

How to write the code correctly (Kik From the Conversation) what would be excluded from the conversation when a command with a mention is used

I was helped to write the code to exclude the user from the conversation, but unfortunately when writing the command in the c ... id, user_id=user_id) When writing a command in the console, it is displayed Message Text: kik [id134674876|Vladislav]

Error in the implementation of Dijkstra's algorithm

I wrote Dijkstra's algorithm for a directed graph. The essence of this named example is that it finds the most likely success ... n range(M): matrix2[int(matrix[i][0]-1)][int(matrix[i][1]-1)] = matrix[i][2] print(Dijkstra(N, begin-1, matrix2,end-1))