Questions tagged as 'python'

1
answer

Recursions in closures

# -*- coding: utf-8 -*- def memoize(limit, *, message = 'Limit exceded'): count = 0 def inner(func): cache = {} def wrapped(number): nonlocal count if count < limit: if number no...
asked by 05.04.2018 / 15:13
1
answer

Matplotlib (Python) slow to plot a 2-D chart?

I have recently come up with the need to use Python to plot graphics with more than 3600 coordinates, but I realized that time may be a problem, but I'm not sure if the code I've done has a performance problem or if it's from the same library:...
asked by 22.03.2018 / 00:09
2
answers

Changing the CSV Delimiter in Python

I'm having a difficulty in the cell delimiter of the CSV file, when I command the save the edited file in CSV % with% delimiter by default is escritor.writerow([linhas]) , plus I need change to , because when I open the file in Ex...
asked by 27.03.2018 / 14:35
1
answer

Regular expressions in pyhton

How can I read a file in python by looking for words that fit into a regular expression, eg searching for dates (dd / mm / yyyy)?     
asked by 27.03.2018 / 12:48
1
answer

Python string corrupted with character \

I have a program that creates another program on the user's computer. In a snippet, I define the directory to which the new program will be destined as diret = "C:\Users\" + d_user where d_user is the rest of the directory. However when it...
asked by 11.04.2018 / 02:49
1
answer

Python import file from variable

If I define a variable as the directory from which I will import a file, such as: a = 'C:\Users\Windows 7\Desktop\Program10.py If I try to from a import foo , I'm given ModuleNotFoundError: No module named 'a'. In context,...
asked by 12.04.2018 / 14:09
2
answers

Count exchange quantities performed with replace in python

I need a help in the code, I need to count how many changes have been made in the sentence, you have some idea to pass me.this code is to remove repeated substrings that are at the end of the sentence, now I need to count how many changes were m...
asked by 13.04.2018 / 21:27
1
answer

Search for Python 3.xx sub-strings

How do I find Substring Events in a string in Python. I need to do in the hand is this my difficulty, I have to go through the string and if I find two occurrences of the same substring I have to remove one. In the output is counted the number o...
asked by 12.04.2018 / 22:35
1
answer

Discover network hosts

When trying to create a script about the subject I had some doubts about the script below! The question is, how am I going to do the "for i in 100" so that it pings the ips, like so 192.168.0.1/192.168.0.2/.../.../192.168.0.100. Code: impo...
asked by 24.02.2018 / 06:21
2
answers

Python: find product of highest value of each array list

Dear Sirs, I already researched a lot before posting my doubt. I'm already discouraged. This is a university job. If you can give me a tip, I appreciate it. The exercise asks: "(c) What is the product of the highest values of each of the li...
asked by 24.02.2018 / 22:46