Questions tagged as 'python-3.x'

1
answer

Bar graph generated with Python has become unreadable. How to improve it? How to work with a dataset of more than 1 million rows?

Friends, The following bar chart was generated (the first column of datasets is UNIX time): ThePythoncode(version3.5)usedwasasfollows:#-*-coding:utf-8-*-importmatplotlib.pyplotaspltimportmatplotlib.datesasdatesfromdatetimeimportdatetime,t...
asked by 26.08.2017 / 16:39
1
answer

Does anyone know how to use a variable of type array to access a position in an array of numpy?

I have A = np.array ([[1,2], 3]) and I want to use [0,1] to make A [0,1] being [0,1] a variable. Would get 2. Does anyone know how to do this?     
asked by 05.12.2018 / 12:13
1
answer

Program only works once

Speak people, I'm debugging python and I'm putting together a simple program that will gradually split the modules, add treatments etc ... The problem is this: in the code below, the program only works once. I create the user and in the end it s...
asked by 29.08.2018 / 12:56
1
answer

How to create a TCP port scanner using the SYN (TCP SYN) method?

##################################### # Portscan TCP # # # ##################################### # -*- coding: utf-8 -*- #!/usr/bin/python3 import socket ip = input("Digite o IP ou endereco: ") ports = [] count = 0 while count < 10:...
asked by 18.08.2016 / 19:58
2
answers

Read files and automatically put in the desired line;

I have several files in a folder: 01.PNG, 02.PNG, 05.PNG, some of the files do not have (04.PNG, 03.PNG). What would be the easiest way to write a text document where each filename would be written to the same line number: So: 01.PNG 02....
asked by 22.01.2018 / 13:59
2
answers

Sum of elements in lists

[[3, 2, 7], [8, -2, 5], [-1, 4, 3], [2, 2, -9]] Next, it saves in three different variables, ignoring the negative values, the sum of the elements separately. That is, the sum of the first element of each sublist, the sum of the second element...
asked by 11.04.2017 / 12:49
1
answer

How to get a correct value using the point?

preco_casa = float (input("Qual o preço do imóvel?")) seu_salario = input("Qual o seu salário mensal?:") anos_a_pagar = input("Quantidade de anos a pagar pelo imóvel:") valor_prestacao = preco_casa / (anos_a_pagar *12) print (" O valor da prestaç...
asked by 04.08.2017 / 17:40
1
answer

How to add a vector within a class?

My teacher passed a job that says the following: Create a Student class, which has a name and cpf as an attribute. Create another class called Team, which has as attribute a list of participants of type Student and other attribute called proj...
asked by 14.09.2017 / 21:51
3
answers

How to test if a host's port is open?

How do I find out if a particular port on a network computer is open? The more efficient the method, the better. I'll need to scan an entire subnet several times a day.     
asked by 23.09.2016 / 00:51
1
answer

How to run this script in a more sophisticated way?

Good morning. I am using this code to update the firmware of my company's servers. However, I wanted to use this same code to update a list of servers, not just one. Follow the original code: #!/usr/bin/python from paramiko import SS...
asked by 06.09.2018 / 11:23