Questions tagged as 'python'

3
answers

How to install pytest on windows 10 - 64 bit, python3

I need to install pytest, it was suggested that I execute the command in cmd:    pip install -U pytest but the error:    'pip' is not recognized as an internal command   or external, operable program or batch file. Someone can inst...
asked by 29.04.2017 / 20:18
1
answer

Scrolling through a file and splitting its contents into separate files using Python

from scapy.all import * pkts = rdpcap("lalalao2.pcap") #time slice de t em segundos : 10 minutos t = 600 somaMin = pkts[0].time + t valores=[] for p in pkts: if p<=somaMin: valores.append(p) else: primslice =...
asked by 05.03.2017 / 13:52
1
answer

Writing IP addresses on file, each IP on a different line using Python

from scapy.all import * pkts = rdpcap("lalalao.pcap") for p in pkts: ## print p.time if IP in p: #if packet has IP layer src_ip = p[IP].src dest_ip = p[IP].dst print src_ip...
asked by 05.03.2017 / 05:17
1
answer

How to filter PCAP file with Python?

The PCAP file was generated on 12/21/2016 and has 5 GB and so it is impractical to try to open it with wireshark (graphical interface) I installed the tshark in Ubuntu and when I read the manual, I tried the following filter: tshark -r cap...
asked by 05.03.2017 / 13:18
1
answer

Data extraction with Python and automatic sending of emails with the information obtained

Friends, The data extraction part is working and the emailing is also partly done. I would like the same information I print on the screen and with the same formatting (jumping line etc) to be sent as part of the email message. I would lik...
asked by 22.02.2017 / 21:50
1
answer

How to allow only a certain word?

How to make only the name "Mary" allowed by the program? I want any other word that I put (ex: John) the user can not continue with the completion of the Form. nome = input("Coloque seu nome: ") cpf = input("Coloque seu CPF: ") endereco =...
asked by 21.02.2017 / 16:56
1
answer

With making posts on Facebook with Python?

import facebook token = 'meu token' graph = facebook.GraphAPI(token) graph.put_object("me", "feed", message="Hello, World!") Friends, I'm using Ubuntu and Python 2.7 and 3.5.2 The following error occurs: "graph = facebook.GraphAPI...
asked by 26.02.2017 / 02:04
1
answer

How to allow only a range of numbers?

I'm making a student number of student registration code, so I want the user to put a number between a range of 1 to 10, MAS also want the ranges to be float (ie: 0.1.0.2 ... 9.8,9.9,10.0). nota_1 = float(input("Digite a primeira nota de "...
asked by 26.02.2017 / 02:02
3
answers

Regular expression in python 3.6 for phrase extraction inteitra

I need to extract only the sentences that contain ADMINISTRATION - JUDGE OF OUTSIDE - NIGHT - SISU - GROUP B, for example. That is, I need to get only the course name, city, shift, O SISU, and the group name of the following string: string = &...
asked by 28.02.2017 / 17:33
1
answer

Strange return when calling a function

I'm trying to do an exercise on functions in Python with the following statement: "Make a program that converts from 24-hour notation to 12-hour notation". Example: Convert 14:25 to 2:25 PM. The program should contain two functions, one that con...
asked by 21.06.2017 / 04:05