Questions tagged as 'python'

1
answer

Use tuple with parentheses in query in django

I made a cursor to get the parent menus of my application, then I want to iterate each parent menu and get the menus associated with it. However, passing parent with parameter, the second course does not work. from django.db import connection...
asked by 01.07.2018 / 00:24
1
answer

Maximum number of rows recommended

Is there a PEP or good practice suggestion that defines what the recommended maximum number of rows a module should be? In my case for example, I keep more than one class per module, obviously classes that are within the same context, domains...
asked by 21.06.2018 / 21:23
1
answer

How to save Python figure with matplotlib?

Any figure I try to save in Jupyter Notebook saves a blank file, what kind of error can be occurring, since it does not acknowledge any errors? import numpy as np import matplotlib.pyplot as plt data1 = [10,5,2,4,6,8] data2 = [ 1,2,4,8,7,4]...
asked by 16.06.2018 / 06:24
1
answer

Save text file in Python

I'm creating a simple text editor with Python and Tkinter and I want to do a function to save what was typed. I did the save function, but it only creates the txt file and does not save what was typed in Text. How can I do this? Here is my co...
asked by 04.02.2018 / 17:52
2
answers

Terminology - What is the difference between instruction and statement?

What would be the difference between them? Instruction would be a line of code representing certain commands / actions passed to the computer to run. Statement, following logic, would it be a type of statement? Since, as far as I understan...
asked by 10.12.2017 / 03:18
1
answer

MySQL Connector for Python 3

I'm doing a project with Django and Python 3 but I can not find the appropriate MySQL connector. django.db.backends.mysql works, but only for Python 2, and I wanted to avoid using that version. In the terminal when I type import djang...
asked by 12.03.2015 / 20:37
2
answers

How do I insert a variable in the middle of the address that I pass to UrlLib2?

I'm using the urllib2 function in Python and I need to put a variable in the middle of the link that I pass to the function. For example: request = urllib2.Request('https://api.stackexchange.com/2.2/users/id_user?order=desc&sort=rep...
asked by 09.06.2014 / 14:19
1
answer

Graph of a denial of service attack in Python

Friends, I generated the following chart: Thecodeusedwasasfollows:importmatplotlib.pyplotaspltimportmatplotlib.datesasdatesfromdatetimeimportdatetime,timedeltax=[]y=[]dataset=open("./datasetDdos10Abril2017_unixtime_slowloris.csv","r") ##s...
asked by 21.08.2017 / 18:18
1
answer

Call progress bar class from another file

I've been trying to find a way to do this, but I can not figure out how to do this, contains a progressbar in pyqt4, I want to call the class of the file passing as a parameter a title, something like: from modules import progressbar progr...
asked by 03.02.2017 / 15:16
1
answer

How to call the previous select id

I have 2 selects, one division and the other group. When the division is selected it has to bring in the second only the groups that are part of that division. In the url variable that takes json I called python according to my view, but instead...
asked by 13.09.2017 / 16:17