Questions tagged as 'python-3.x'

1
answer

Comparison between two objects in Python using the id () function with different result

Searching, I noticed that the id() function returns an integer and ensures that it is unique and constant for the object. When comparing two objects I get different results, what may have made these different results possible? I not...
asked by 20.10.2016 / 19:03
1
answer

Concurrent.futures and Class object

I'm trying to create a class (Processor) that performs a series of functions to get results from a State-to-State API. (STATE) 1- READ DATA FROM A TABLE. 2- SEND request for the API to process. 3- WAIT jobs to be complete. 4- DOWNLOAD the re...
asked by 02.10.2016 / 23:30
1
answer

Return the position of a word in a string

Can anyone help me with this question? def fileRead(file): txt = open(file) print(txt.read()) def index(filepath, keywords): with open(filepath) as f: for lineno, line in enumerate(f, start=1): matches...
asked by 21.09.2016 / 22:46
1
answer

How to find a "li" tag with a "dorm" text from a tag list in python3?

I'm learning to program now, and python is the first language I'm working on and I'm having trouble catching the tag: <li> 4 dormitórios from the html below: <div class="crop"> <ul style="width: 500px;"> <li><st...
asked by 30.08.2016 / 18:02
1
answer

TypeError: split () missing 1 required positional argument: 'string'

One more basic question on my part. I am 'Pythonista' super basic level and am trying to simply read a text line by line and make a split each time I find a punctuation mark or a space. I tried this: import re with open('est.txt', '...
asked by 16.10.2016 / 13:03
1
answer

Sending a payload with scapy

from scapy.all import * ip = IP(dst = "192.168.1.1") tcp = TCP (dport = 80, flags = "S") raw = Raw(b"Olaa") pkt = ip/tcp/raw sr(pkt) ans,unans = sr(pkt) I'm learning how to use Python Scapy. I could not understand what is raw. Why to se...
asked by 12.08.2016 / 22:54
1
answer

How to "generate" multiple TCP clients using Threads in the same script?

I wrote the code for a simple TCP client: from socket import * # Configurações de conexão do servidor # O nome do servidor pode ser o endereço de # IP ou o domínio (ola.python.net) serverHost = 'localhost'#ip do servidor serverPort = 50008 #...
asked by 17.08.2016 / 21:31
1
answer

Python - PHPSESSID

I'm trying to create a script that enters a website without having to log in through the requests library. I want to do this using the PHPSESSID cookie. How can I do this?     
asked by 01.08.2016 / 15:53
1
answer

Creation of a random vector

from random import randint # para gerar os nums aleatorios def criaVetor(L, H, tam): vec = [] for i in range(tam): # vamos fazer isto tam (N) vezes vec.append(randint(L, H)) # gerar numero aleatorio entre L e H, e colocar na noss...
asked by 21.08.2016 / 18:02
1
answer

Compare values of two arrays

Hello, I need to compare 2 values of 2 arrays, but I'm not if getting: plan = [{'Cod': '11518', 'qtdPallet': '176', 'qtdLastro': '22', 'qtdCx': '12', 'Prod': 'Exemplo1', 'FC': '1'}, {'Cod': '972', 'qtdPallet': '72', 'qtdLastro': '9', 'qtdCx':...
asked by 16.06.2016 / 15:29