Questions tagged as 'python'

2
answers

Use variables when formulating query to filter data from a table

I am working with Python and MySQL in a Tkinter application. I'm trying to do a search filter to only show me the entries in my table that correspond to what I entered with the keyboard but I do not know how to set it in the SQL statement. Th...
asked by 26.12.2017 / 18:46
2
answers

Display images from a database in Django

I have a model that has an image field, at the beginning the image was shown, but after I made a few changes but without changing the code that serves the image now it does not work, I have tried everything but it does not work, this is the code...
asked by 17.10.2017 / 13:53
2
answers

Get part of a Selenium Python url

I have this URL and I just want to get a part of it: https://onevideo.aol.com/#/inventorysource/1024374?makeDuplicate=true The part I want to obtain is the id: 1024374 to then enter it in this other url: https://onevideo.aol.com/inventory...
asked by 24.10.2017 / 00:25
1
answer

Access element, list list - Python

Very good, I am new to Python and I am now struggling with the lists. I expose what I have developed. Currently I have a program that loads the following data structure through a .csv file. 1,4.0,?,?,none,? 2,2.0,3.0,?,none,38 2,2.5,2.5,...
asked by 01.11.2017 / 15:54
2
answers

Error in conditional with estamento in: "requires string as left operand, not set"

I am creating a loop that will iterate over a list of given strings. For this I have created a set of data on which I will establish my conditions within the loop. But I think I'm doing something wrong because in the Python shell I get the fo...
asked by 03.10.2017 / 20:29
1
answer

Error in import: module 'random' has no attribute 'randint'

I was testing the corrected code for this question: Modify global variables . And when I try to execute it in the terminal it throws me an error that says that the% random module does not have the randint attribute (which does not...
asked by 21.09.2017 / 22:33
1
answer

Python 3: AttributeError

Hello, I am trying to make a very simple program that creates the data of a rectangle and finds its center: class Rectangulo: pass def encuentra_centro(box): p = Rectangulo() p.x = box.esquina.x + box.anchura / 2.0 p.y = box.es...
asked by 16.09.2017 / 23:43
2
answers

I do not clarify with the loops for in Python

I am currently learning to program in python, and I have not just clarified with the loops: The exercise consists of going through the list n and having the variable result of the function join_strings be those two words togethe...
asked by 26.09.2017 / 19:02
1
answer

Error modifying elements in sublists, all end with the same content

Someone could tell me why I have an error in the following code: tabla=[] linea=['0'] for k in range (3): linea.append('') for k in range(12): tabla.append(linea) i=0 for k in ['1','2','3','4','5','6','E','F','P','G','2G','T']: tab...
asked by 27.09.2017 / 15:26
1
answer

RelatedObjectDoesNotExist User has not profile

I'm trying to create a profile model for the general user that Django has by default, but it seems that when creating a user from manage.py I get the error that the title has along with this one: django.db.utils.IntegrityError: NOT NULL...
asked by 24.08.2017 / 22:32