Questions tagged as 'python'

1
answer

How to use files in python

I'm still finishing a program as a prog I work and I'm having a lot of trouble with the files part. I am not able to insert an array into the file. Does anyone know how to do this? The program is about Einstein's game, and has to have the fol...
asked by 09.03.2016 / 00:50
1
answer

Repeat code for the same product group [closed]

I have a spreadsheet with thousands of products as the example below, where the code is only in the type of service (left column), and I want it to appear in all products of the same type (right column). In practice, I want code '1' to be dragge...
asked by 22.12.2018 / 00:42
2
answers

List counting elements [closed]

I have a list, like this: L = [0, 0, 1, 1, 1] If you used the command SET : L = [0,1] sum(L) = 2 The answer I need would be: 3. Each response pair would be a point, as it has two '0' = 1, one point, three '1' = 2 NOTE: I'm sorr...
asked by 12.09.2018 / 14:22
1
answer

How to change a specific word in one TXT by another

I need to change the configuration of the Zabbix server that is in this directory C:\zabbix\conf\zabbix_agentd.win.conf I need to replace the word: hostname= with hostname=192.168.1.1 I did this, but the part under...
asked by 27.06.2018 / 16:21
1
answer

Error in test code: object () takes no parameters

I made a test code, but I do not know the error, does anyone help me? class Caneta: def _init_(self, cor, modelo, ponta): self._cor = cor self._modelo = modelo self._ponta = ponta self._carga = 100 s...
asked by 20.06.2018 / 22:34
1
answer

What differences are there in using a .txt and .bat file in python?

I'm looking for practical and simple ways to save information in a separate file, which even after the program closes.py (In python) the information is not lost. And therein was a question, what are the advantages of using a .txt and .bat file t...
asked by 22.06.2018 / 22:14
1
answer

Why does not print return all items in a list?

The following code should return all cars from the following list: cars = ['audi','bmw','subaru','toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) But just returned: BMW Toyota What'...
asked by 12.06.2018 / 02:37
1
answer

Error using QLabel class method - PyQt5

I'm trying to create an application that does the following: every time the user clicks on an image that will be inside a QLabel, it will open a dialog for the user to open another image. It happens that you give the following error the setPi...
asked by 12.10.2017 / 00:26
2
answers

Finding strings in a log and other patterns [closed]

I'm trying to identify two strings in a log file: "connected" and "disconnected". But I'm not sure how to make it work. On my server I have stored several log files import os import time import re data = time.strftime("%d.%m.%Y") logs = [...
asked by 20.12.2017 / 00:06
1
answer

Doubt of command in Python

I'm migrating from batch programming to Python, in batch there was the "goto" command, which basically created a sub-area within the command: goto EXEMPLO pause :EXEMPLO pause So, when the command arrives in "EXAMPLE" it jumps to the line...
asked by 12.12.2017 / 19:14