Questions tagged as 'python'

1
answer

How do I keep a dictionary so I do not lose its content?

I was creating a simple program to review words in English and I had a question. How can I save the words entered in the dictionary created for a future session? . When you close the program and reopen, all the words in the dictionary are del...
asked by 09.05.2017 / 23:16
5
answers

add strings by means of a for loop in Python

estimates, a query how can I add strings using a for loop in Python? , in my particular case, I want to add consecutive elements of a list and convert them into a single string n=int(input("ingrese un numero)) a[[w,e,r],[t,d,f],[e,h,j]] f...
asked by 21.05.2017 / 04:13
3
answers

Compare arrays in python

I have a problem when I want to compare two results obtained from two different sql queries; example queryUno[0] and queryDos[0] . It turns out that I tried to use list(set(list1).difference(list2)) and it did not work bec...
asked by 09.11.2016 / 21:26
1
answer

Python: numpy and pandas modules

Can anyone explain to me what this code does? import pandas as pd import numpy as np df = pd.read_csv('Prueba.csv', sep=';') numIteraciones = df.columns.size - 6 for i in range(1,numIteraciones+1): col = str(i) comando = df[col][0]...
asked by 25.11.2016 / 08:45
3
answers

Syntax error when executing

I'm doing a calculator with Python. I started learning Python recently, so I do not know much about it. When I run the code, it gives me    "Syntax Error" What is the solution? I keep giving the same error! ~ Here the code: while True:...
asked by 21.11.2016 / 14:01
1
answer

Access a variable in Django's template having its name in string

{% for x in array%} {% for y in x %} <h1>{{y}}</h1> {% endfor %} {% endfor %} With x in the second for the key of a dictionary whose value is an array, and x in the first for a string...
asked by 03.05.2017 / 10:09
2
answers

Problem counting correct answers

I am developing a program to ask me words. I try to collect the number of correct answers, but the counter gives me in all cases 0 or 1 . How can I solve it? Here the code: diccionario = {} numeropalabras = int(input("¿Cuan...
asked by 22.11.2016 / 14:33
2
answers

How to add or concatenate data from a list?

Cordial greeting. I have a list with str inside it in the following way: l1=['hola estas','como Carol','esta tu ','aqui papa '] and I want something like this to stay: l2=['hola-como', 'estas-Carol','esta-aqui', 'tu-papa']...
asked by 27.04.2016 / 19:06
1
answer

python scrapy remove the blanks from the answer

I am trying to make a scrapy script and I am not capable of what the strip method removes the blanks ... It should be a string but it is an object. Any way to do it? import scrapy class GamesSpider(scrapy.Spider): name = "games" start...
asked by 20.12.2018 / 09:15
1
answer

Publish project in Python 3.5 with heroku

Hi, I have a project made with Python 3.5 and Django 1.10 and I would like to publish it in HEROKU but I see that it only supports Python 2.7, does anyone know if heroku supports Python 3.5?     
asked by 18.09.2016 / 03:56