Questions tagged as 'python'

1
answer

Why use the __init__ constructor method in Python? [duplicate]

I would like to understand better why using __init__ by comparing these two code, I even understood that __init__ will always be started with the instantiated object, but should I always use it? With __init__: class C...
asked by 18.09.2018 / 18:47
2
answers

Automation of tasks in linux [closed]

Well, I already know python and I know that it is very good for working with scripts and automation of tasks but my question is, I can work comfortably with administration and automation of linux and database environments only with python or is...
asked by 27.05.2018 / 16:06
2
answers

Sum of Integer Numbers in a txt File

I have two txt files that contain only numbers (number per line), so I want to add line 1 + line 1 so in succession to the last line of each file. Each file has the same line number. ** In this code I can only print the first sum of the first...
asked by 18.02.2018 / 17:23
1
answer

Problem displaying items in a qtablewidget

Only the first two rows of the table are populated, but the row numbers of the table are filled as per the query result, and in print displays all the items normally. def escreveArquivo(self): con = MySQLdb.connect(host="localhost", user="...
asked by 09.10.2017 / 03:31
1
answer

Tkinter, how to use the same script in win and llinux without the window icon disturbing [duplicate]

I've been writing scripts in Win VS and when I switched to Linux, I came across the following problem: When I use an image as a window icon in Linux (which does not have the same) the script does not execute. How can I "detect" the OS so it...
asked by 20.06.2018 / 19:22
1
answer

How do I pass values from a CSV to a JSON in Python?

I tried two ways to read a CSV file and pass the values in the JSON value parameter, however, it does not return any results, if I pass the values straight, it works. Code 1: import boto3 from datetime import datetime import csv client = b...
asked by 12.10.2018 / 19:43
1
answer

Variable not defined Python

I'm trying to run a code and from one moment to the other is giving this error, for example if you type "m" Traceback (most recent call last): File "Energias", line 5, in <module> var = input("\nQue desejas calcular?: ") File "&l...
asked by 29.07.2016 / 23:19
3
answers

Start numeric variable with null value in Python

Navigating through the Python web site, I decided to do exercise 1 from the Repetition Structure list: "Make a program that asks for a note, between zero and 10. Show a message if the value is invalid and continues to prompt until the user en...
asked by 17.11.2017 / 19:15
1
answer

Can you do self-executable script in Python? (Autorun)

Hello, I'm starting to learn Python, I know only the basics of the basics, I wanted to do a self-executable script (autorun), but I searched all over the internet and found nowhere to do an autorun in Python, so , is there any way to do this? If...
asked by 01.12.2017 / 00:48