Questions tagged as 'python'

1
answer

Add a new value to a list

Is there any way to add a new value to a list in Python from a user input? Example: Entrada = int(input("Digite um número")) lista = [] #A partir da entrada acima eu gostaria de expandir esta lista     
asked by 23.12.2016 / 16:31
2
answers

Problem in condition when checking if user typed "n", "N", "s" or "S"

print("--------------------") print("CALCULADORA DE MÉDIA") print("--------------------") print() #Primeira nota v1 = float(input("Digite a primeira nota: ")) #Segunda nota v2 = float(input("Digite a segunda nota: ")) #Média media = (v1 + v2...
asked by 01.01.2017 / 23:10
1
answer

"repeat ... even cond." function in Python

I wanted to know if the following function, written in pseudocode, exists in the Python language: repeat (commands) to (condition); Thank you.     
asked by 25.03.2017 / 16:28
1
answer

GPing should be called as first argument

if __name__ == '__main__': top_100_domains = ['google.com','facebook.com','youtube.com','yahoo.com','baidu.com','wikipedia.org','live.com','qq.com','twitter.com','amazon.com','linkedin.com','blogspot.com','google.co.in','taobao.com','sina.com.cn'...
asked by 31.03.2017 / 21:27
1
answer

Reading csv with django

Well, I'm working with an open database, and it's in CSV, I'm using DJANGO to read the CSV and thus inserting into the database ... But it's failing to insert the first year, I'm trying to insert 8 years of data, the first year it inserts only 1...
asked by 01.09.2016 / 00:43
2
answers

TypeError: Incorrect padding

I am trying to decrypt AES, but I am encountering the following error:    Traceback (most recent call last):     File "./teste2.py", line 190, in main ()     File "./teste2.py", line 186, in main decrypt (password)     File "./teste2.py",...
asked by 14.03.2016 / 00:18
1
answer

Problem with urllib3 and API Twitter

Save money on duty I'm using this font for twitter API link When running the error examples:    File "stream_tweets.py", line 1, in       from TwitterAPI import TwitterAPI File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/Twi...
asked by 24.03.2016 / 21:36
1
answer

Factorial with multiple entries in Python

I need to write a program in the Python language that reads multiple entries, and that, upon receipt of the "-1" entry, the program prints the factorials of their entry numbers. Detail: I need to use the while loop function, since it i...
asked by 18.03.2016 / 23:27
2
answers

Choose folder to save a file

I have this code that I select the place to save the file filename_2 = QFileDialog.getSaveFileName(self.dlg, "Select output file") self.dlg.pasta_saida.setText(filename_2) But I would like to choose the folder to save the file insid...
asked by 07.01.2016 / 14:32
1
answer

Refactoring Python code

How do I improve this code? import random import string import requests from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError from optparse import make_option from core.models impo...
asked by 23.11.2015 / 08:05