Questions tagged as 'python-3.x'

2
answers

Reading .CAP files efficiently with Python

I have some .CAP files that came from capturing packages with tcpdump. When trying to open with wireshark, the machine gets very slow, as I imagine it will try to load everything into RAM. I would like to write a program in Python to work mor...
asked by 01.03.2017 / 20:55
1
answer

Remove duplicate dates by adding values

I need to remove the duplicate dates from the dataframe and add the values corresponding to those dates. I found an answer in the NA stack that is close to the one I need, but I could not shape it for my need: df.groupby('data', group_keys=...
asked by 21.06.2017 / 21:54
2
answers

Run script written in Python on windows (No python installed)

I have a script written in Python (3.6) that works normally if run on my PC (which has Python installed) My question is: If I run it on some other windows that do not have python installed, will it run normally? And if it does not work, is...
asked by 28.06.2017 / 00:36
1
answer

How to convert this code from version 2 to 3.4 of Python?

I am having difficulty converting the code below to Python's 3.4 version, the purpose of this code is to encode and decode hexes in order to create shellcodes . import binascii, sys, time RED = '3[31m' WHITE = '3[37m' RESET = '3[0;0m' def...
asked by 03.04.2015 / 07:18
2
answers

Difference between dates / times in Python

I need to calculate the difference between two dates in python, but always some error. >>> from datetime import datetime >>> data1 = datetime(2015, 8, 5, 8, 12, 23) >>> data2 = datetime(2015, 8, 9, 6, 13, 23) >>...
asked by 13.08.2015 / 21:10
1
answer

What are environment variables?

I have seen many questions, articles and even some modules in the standard Python library where a term that is "environment variables" is introduced. Here in StackOverflow there are many issues that speak of them, but always on how to manipulate...
asked by 27.10.2018 / 23:39
2
answers

python string manipulation

I'm having a problem with python \ b (backspace), instead of deleting the previous character, it generates a "•" as shown below: Thefollowingisthelineofcodethatgeneratesthisreturn:#-*-coding:utf-8-*-importpyodbcimportplatformimportjson#-----...
asked by 04.07.2018 / 22:30
1
answer

Is it possible to inherit a class in python without writing all the attributes in the definition?

I have the following sample code: from Testes import POO class Fisica(POO.Cliente): def __init__(self,sexo,nome,idade): super().__init__(nome,idade) self.sexo = sexo Note that the attributes name and age are the attribut...
asked by 20.09.2018 / 03:15
1
answer

Python dunders __copy__ and __deepcopy__

I have already seen in some codes, mainly in Django the dunders __copy__ and __deepcopy__ , the idea behind them I understand that provide copies of the object, but usually the dunders can be called say say% with% d of som...
asked by 08.08.2018 / 08:24
2
answers

Local variables declaration in a PYTHON function [duplicate]

def fib(n): a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a+b print() result- > 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 But if I declare variables a and b on different lines, it b...
asked by 08.08.2018 / 16:06