Questions tagged as 'python-3.x'

1
answer

I can not change the value of variables within a loop

I'm trying to solve the following exercise:         To develop a program to verify the student's grade in a 10-question test, the program should ask the student the answer to each question.     question and at the end compare with the test te...
asked by 09.11.2015 / 17:05
1
answer

QComboBox.addItems: called with wrong argument types

I have the following code: self.option = QComboBox(self) self.option.addItems(self.getJson) def getJson(self): self.data = {'image' : ['planet.jpg', 'cat.png', 'building.jpg']} return self.data['image'] I want to make the return o...
asked by 22.08.2016 / 20:06
2
answers

Find out if a timedelta object has any negative attributes

I have a function that takes a parameter of type timedelta . I'm looking for ways to know if the object passed by parameter has any of its (days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0) negative att...
asked by 29.12.2018 / 12:52
1
answer

Imports within functions in Python

I've seen cases where the developer does the import of a module within a function, some cases mainly in the documentation of Django, why it was not very clear to me, if anyone can help me thank you.     
asked by 11.07.2018 / 01:43
2
answers

Method split and rsplit, python

I made this little program to try to simulate the methods 'split' and 'rsplit' of Python , but when I run it it does not print the last sentence of the string. For example, if in the string I type 'pao ou açucar ou café'...
asked by 15.09.2018 / 18:39
2
answers

Remove blank lines in a csv

I'm trying to remove empty rows from a csv document: Document:    sentence, lingua      ., pt      ., in      ., in      ., it      ., en      ., pt      ., pt      ., en      ., pt      ., pt       "it's not expensive", in   ...
asked by 25.06.2018 / 11:52
1
answer

Problems with __eq__, __lt__, etc. and the method removes the object list

I'm having the following problem, I have a class letter and I use the magic methods eq , ne , le , lt , gt to be able to compare the value of two cards and also to be able to use the sort function, and this works the way I expected but whe...
asked by 29.06.2018 / 15:22
1
answer

Separating a dataframe by some criteria - Python Pandas

I have a csv file with more than 500,000 lines that I would like to separate into two dataframes. The format of each line: date, time, value of the variable of interest dd-mm-aa, hh: mm: 00, float The lines are recorded every minute. In...
asked by 03.06.2018 / 02:45
3
answers

Difficulty with first code

This is my first code that does not involve my course classes. My goal is to put together a code that asks that any chemical symbol be inserted and this will tell your group. Very simple concept, but I'm having difficulties in it. elemento = s...
asked by 13.11.2018 / 23:22
1
answer

Check url after request

How do I make my code check which url / link is in?    My code: import requests as r from bs4 import BeautifulSoup as bs import time import os clear = lambda: os.system('cls') clientes1 = 0 clientes2 = 0 ok = [] req = r.get('https://www...
asked by 18.05.2018 / 15:42