Questions tagged as 'python-2.7'

1
answer

Showing total connections to a certain IP address

I have a network dump (PCAP file) containing slowloris attacks. The following script will show the number of connections to IP 192.168.1.2 on port 80: /usr/sbin/tcpdump -anr myfile.pcap | sed 's/^.*IP \([^:]*\)192.168.1.2.80:.*//p;d' |...
asked by 15.05.2017 / 03:03
1
answer

Error with requests with scrapy

I have a csv file with some urls that need to be accessed. http://www.icarros.com.br/Audi, Audi http://www.icarros.com.br/Fiat, Fiat http://www.icarros.com.br/Chevrolet, Chevrolet I have a spider to do all the requirments. import scrapy i...
asked by 09.09.2016 / 15:19
2
answers

How to remove spaces at the beginning and end of an XLS output

I have the code below, so it opens a spreadsheet in XLS and shows me the header. however I would like the left and right spaces to be removed and the internal spaces to be replaced by underline is there any function in xlrd that do...
asked by 18.11.2015 / 15:48
1
answer

Remove whitespaces from the list in Python

I'm reading a file, stopwords.txt , and in this file each stopword is in a line, a o para Each stopword I am saving in a list as follows: with open(sys.argv[1],"r") as file_entrada: lista_nome_base_docs = [line.rstrip() for l...
asked by 05.10.2017 / 15:09
2
answers

Displaying certain vectors in a 2D Python list

I have the following situation: - I have a variable called (distrow_vector). This variable receives a 2D list with multiple vectors. - I want it to be displayed, only vectors whose sum of their indexes are less than 100. - I have the code below,...
asked by 26.02.2017 / 19:43
1
answer

How to set a Tray Icon (tray icon) in a PyQt application?

I'm still new to PyQt and would like to clarify a question: Is there any way to define a Tray Icon in a PyQt application? If so, how can I do it? I need to set some options on this tray icon. Can you do that too?     
asked by 11.11.2016 / 13:04
1
answer

Subtract 2 weeks from a complete date in pyhton

I'm thinking of a date in this format: time.strftime("%d/%m/%Y") // 00/00/0000 I want to subtract two weeks from that date, but I do not know how to do it.     
asked by 20.01.2017 / 18:48
1
answer

How to execute arbitrary code in Python?

I use an xBase language that has macro replacement as in the original Clipper. Is there something equivalent in Python? We use a lot of command line assembly via menus at runtime. For example, making filters.     
asked by 01.07.2016 / 14:28
1
answer

Why does the input work in Python 3.x and not in 2.7?

I ran this same code with only a few minor differences in syntax to fit the right script mode in Python version 2.7.9 and also in Python 3.4.2 Script that I rode in Python 2: name=input("tell me your name:") print 'Hello',str(name),'!'...
asked by 13.05.2017 / 23:51
1
answer

Have two versions of Python on OSX without overwriting

Is there a way to install Python's 3.x version without overwriting the pre-installed (essential) version of OSX? I already know virtualenv but I'd like to avoid it, because I only use Python to study. Is there any way to keep both versi...
asked by 20.08.2015 / 00:45