Questions tagged as 'python-2.7'

1
answer

How to do a "time-slice" in packages in a network dump with Python?

I'm trying to "catch" source IPs and destination IPs inside a network dump (PCAP) file. The idea is to save all source IPs and all destination IPS by scanning the file every 10 minutes ("time-slice"), for example. The code below opens the dum...
asked by 03.03.2017 / 01:43
2
answers

Summing consecutive integers in a list - Python

I have the following code: i = -0 soma = 0 lista = [1,2,3,4] for i in xrage(0,len(lista)): if lista[i] != lista[i+1]: soma += lista[i] i+=1 print soma You are giving the following error: IndexError: list index out of rang...
asked by 27.05.2016 / 05:45
1
answer

Make 1 figure with 3 graphics

I have 3 functions like the following that allows to obtain each one a graph and I intend a function in which it uses the 3 graphs of the other functions to join in a single figure. def funcao1(grafico): ... pylab.plot(range(len(x)), y...
asked by 23.05.2016 / 19:35
1
answer

Problem returning sh: 0: -c requires an argument

Good luck guys, I have this code below for python 2.7: #!/usr/bin/env python # -*- encoding: utf-8 -*- import sys import os if len(sys.argv) <= 3: for comando in sys.argv[1:]: shell = os.system(comando) print comando...
asked by 25.11.2015 / 02:04
3
answers

Iteration using "while"

I have a little trouble understanding while and I came across an exercise that asked me to do the following: Read N sequences and find out how many 'f's' in each sequence. I can not use for on this issue. My code looks like t...
asked by 10.12.2018 / 22:11
1
answer

Page Display Error - Django

In Django I'm developing a Library project! (I'm new to Django, I've never worked with web development) In summary, I have a model library and a model book in the models.py file, in the Model book there is a ForeignKey Library. The entire...
asked by 15.05.2014 / 20:42
1
answer

How to make crontab run a script in Python

I'm trying to schedule a script I wrote in Python to run in crontab , but I'm not able to do it. The script is simple thing, it makes a telnet connection through the terminal and sends some commands. I was able to schedule a shellscript , howe...
asked by 09.03.2018 / 02:46
1
answer

Submit POST form with python

I'm developing an API in my work, and I need to develop something in python2 that sends a form to the server through POST, I saw some questions here in the forum and I could not find anything that worked ... I need the community to help me !...
asked by 16.12.2017 / 01:49
1
answer

Processes in Python

I am studying the multiprocessing module and in all the examples in the Python documentation There is always a% checking in the examples, I know this checks to see if the file is being executed directly or being imported but has some...
asked by 08.08.2018 / 19:49
1
answer

RuntimeError: maximum number of recursive calls exceeded - python

fibonacci_cache = {} def fibonacci(n): if n in fibonacci_cache: return fibonacci_cache[n] if n==1: value=1 elif n==2: value=1 elif n>2: value=fibonacci(n-1) + fibonacci(n-2) fibonacci_cache[n]=...
asked by 07.11.2017 / 19:51