Questions tagged as 'python-2.7'

1
answer

What is the difference between 'dump' and 'dumps' from the Pickle module in Python?

I've read the Python documentation and also Pickle's own, but I was not able to assimilate the content (lack of examples). On the Web I only found information on how to use dump + load and nothing on dumps + loads     
asked by 15.05.2015 / 01:38
1
answer

Attraction of objects in python

I'm writing a code where one image goes towards another one that for some reason is not working. I take the distance between them by calculating the force of gravitational% with% of attraction between them and decompose the resulting vector i...
asked by 08.05.2015 / 22:03
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
3
answers

Maximum occurrences in a python dictionary

If I have the dictionary: meu_dic = {A:3, B:5, C:0, D:10, E:2} resulting from: meu_dic = {i:lista.count(i) for i in lista} I know A appears 3 times in the list, B 5 times, etc. How can I return the maximum number of reps and their...
asked by 27.05.2016 / 16:47
1
answer

list assignment index out of range

A part of my Python program is: dt=1 maxt=3600*2 t=range(0,maxt,dt) r=len(t) Tsup_i=20 for i in range(1,r): Tsup[0]=Tsup_i P[i]=((I_dc)**2) * R20 * (1 + a * (Tsup[i] - (20+K))) And the error is appearing    "IndexError: list ass...
asked by 15.02.2016 / 11:51
1
answer

Editing python files

I have the intention of inserting into the files .py the following section: -*- encoding: utf-8 -*- It needs to be specific online, and in large amount of files. Is there any unix / linux tool that can perform this task?     
asked by 10.06.2015 / 21:16
1
answer

How to mount a url in Django?

To learn Django, but one thing that I have not understood very well is how to set up a url, I know that it uses regular expression, but someone there has a way to explain it to me, p>     
asked by 28.01.2015 / 20:00
2
answers

Python error access is denied

You're giving this error while trying to run the project: before that I had installed python 2.6 on the machine ... but I already had python 2.7 could this have caused the error?    [Error 5] Access is denied:   'Python-Eggs \ mysql_python-1....
asked by 01.09.2014 / 18:40
1
answer

How do I change the width of the columns in the Admin listing in Django?

How do I specify the width for the columns that are displayed in the Admin listing, more precisely the ones I specify in list_display in admin.py. Searching a similar question here , where I came to the conclusion that I should extend the file...
asked by 19.01.2016 / 15:54
2
answers

Flask and its contexts

I'm new to desenvolvimento Web and I'm studying FLask and it has some objects that should only be manipulated in certain context like Flask.g and Flask.current_app what I can not understand are the differences between...
asked by 30.11.2018 / 21:46